Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS1wNmg0LTkzcXAtamhjbc0yJA
Command injection in Parse Server through prototype pollution
Impact
This is a Remote Code Execution (RCE) vulnerability in Parse Server. This vulnerability affects Parse Server in the default configuration with MongoDB. The main weakness that leads to RCE is the Prototype Pollution vulnerable code in the file DatabaseController.js
, so it is likely to affect Postgres and any other database backend as well. This vulnerability has been confirmed on Linux (Ubuntu) and Windows.
Patches
Upgrade to Parse Server >=4.10.7. If you are using a prerelease version of Parse Server 5.0 (alpha, beta) we will publish a timely fix for these. However, as a general reminder we do not consider prerelease versions to be suitable for production deployment.
Note that as part of the fix a new security feature scans for sensitive keywords in request data to prevent JavaScript prototype pollution. If such a keyword is found, the request is rejected with HTTP response code 400
and Parse Error 105
(INVALID_KEY_NAME
). By default these keywords are: {_bsontype: "Code"}
, constructor
, __proto__
. If you are using any of these keywords in your request data, you can override the default keywords by setting the new Parse Server option requestKeywordDenylist
to []
and specify your own keywords as needed.
Workarounds
Although the fix is more broad and includes several aspects of the vulnerability, a quick and targeted fix can be achieved by patching the MongoDB Node.js driver and disable BSON code execution. To apply the patch, add the following code to be executed before starting Parse Server, for example in index.js
.
const BSON = require('bson');
const internalDeserialize = BSON.prototype.deserialize;
BSON.prototype.deserialize = (buffer, options = Object.create(null), ...others) => {
if (options.constructor) {
options = Object.assign(Object.create(null), options);
}
return internalDeserialize(buffer, options, ...others);
};
const internalDeserializeStream = BSON.prototype.deserializeStream;
BSON.prototype.deserializeStream = (
data,
startIndex,
numberOfDocuments,
documents,
docStartIndex,
options = Object.create(null),
...others
) => {
if (options.constructor) {
options = Object.assign(Object.create(null), options);
}
return internalDeserializeStream(
data,
startIndex,
numberOfDocuments,
documents,
docStartIndex,
options,
...others
);
};
References
- Original report on huntr.dev
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wNmg0LTkzcXAtamhjbc0yJA
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Critical
Classification: General
Published: almost 3 years ago
Updated: almost 2 years ago
CVSS Score: 10.0
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
EPSS Percentage: 0.37793
EPSS Percentile: 0.97224
Identifiers: GHSA-p6h4-93qp-jhcm, CVE-2022-24760
References:
- https://github.com/parse-community/parse-server/security/advisories/GHSA-p6h4-93qp-jhcm
- https://github.com/parse-community/parse-server/commit/886bfd7cac69496e3f73d4bb536f0eec3cba0e4d
- https://nvd.nist.gov/vuln/detail/CVE-2022-24760
- https://www.huntr.dev/bounties/ac24b343-e7da-4bc7-ab38-4f4f5cc9d099/
- https://github.com/advisories/GHSA-p6h4-93qp-jhcm
Blast Radius: 30.8
Affected Packages
npm:parse-server
Dependent packages: 122Dependent repositories: 1,211
Downloads: 174,945 last month
Affected Version Ranges: < 4.10.7
Fixed in: 4.10.7
All affected versions: 1.0.0, 1.0.1, 1.0.2, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.0.10, 1.0.11, 1.0.12, 1.0.13, 1.0.14, 1.0.15, 1.0.16, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 2.2.9, 2.2.10, 2.2.11, 2.2.12, 2.2.13, 2.2.14, 2.2.15, 2.2.16, 2.2.17, 2.2.18, 2.2.19, 2.2.20, 2.2.21, 2.2.22, 2.2.23, 2.2.24, 2.2.25, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.4.0, 2.4.1, 2.4.2, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0, 2.6.1, 2.6.2, 2.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