CVE-2022-24760: Parse server Command Injection Vulnerability
CRITICALCVE-2022-24760 is a CRITICAL (CVSS 10.0) command injection vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Parse server libraries in the npm ecosystem. The issue involves command injection in parse server through prototype pollution. Remediation is available by upgrading affected packages to version 4.10.7.
CVE-2022-24760 at a Glance
Security Impact
CVSS: 10.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2022-24760
To remediate this vulnerability, upgrade all affected Parse server dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install parse-server@4.10.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls parse-server
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2022-24760, inspect your project dependencies using npm:
npm ls parse-server
Analyze the terminal output to locate any version of Parse server in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.10.7), your application is affected.
Note: The npm ls parse-server command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In Parse server, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-24760 Affected Parse server Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
parse-server
|
npm |
< 4.10.7
|
4.10.7
|
References
Frequently Asked Questions
What is CVE-2022-24760?
Which Parse server versions are affected?
What version fixes CVE-2022-24760?
Is parse-server affected?
What is the CVSS score of CVE-2022-24760?
What CWE is associated with CVE-2022-24760?
How can I check npm dependencies for CVE-2022-24760?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-p6h4-93qp-jhcm",
"modified" : "2022-04-19T18:24:25Z",
"published" : "2022-03-11T23:53:23Z",
"aliases" : [ "CVE-2022-24760" ],
"summary" : "Command injection in Parse Server through prototype pollution",
"details" : "### Impact\nThis 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.\n\n### Patches\nUpgrade 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.\n\nNote 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.\n\n### Workarounds\nAlthough 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`.\n\n```\nconst BSON = require('bson');\n const internalDeserialize = BSON.prototype.deserialize;\n BSON.prototype.deserialize = (buffer, options = Object.create(null), ...others) => {\n if (options.constructor) {\n options = Object.assign(Object.create(null), options);\n }\n return internalDeserialize(buffer, options, ...others);\n };\n const internalDeserializeStream = BSON.prototype.deserializeStream;\n BSON.prototype.deserializeStream = (\n data,\n startIndex,\n numberOfDocuments,\n documents,\n docStartIndex,\n options = Object.create(null),\n ...others\n ) => {\n if (options.constructor) {\n options = Object.assign(Object.create(null), options);\n }\n return internalDeserializeStream(\n data,\n startIndex,\n numberOfDocuments,\n documents,\n docStartIndex,\n options,\n ...others\n );\n };\n```\n\n### References\n- Original report on [huntr.dev](https://www.huntr.dev/bounties/ac24b343-e7da-4bc7-ab38-4f4f5cc9d099/)\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "parse-server"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.10.7"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/parse-community/parse-server/security/advisories/GHSA-p6h4-93qp-jhcm"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-24760"
}, {
"type" : "WEB",
"url" : "https://github.com/parse-community/parse-server/commit/886bfd7cac69496e3f73d4bb536f0eec3cba0e4d"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/parse-community/parse-server"
}, {
"type" : "WEB",
"url" : "https://www.huntr.dev/bounties/ac24b343-e7da-4bc7-ab38-4f4f5cc9d099"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1321", "CWE-74" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2022-03-11T23:53:23Z",
"nvd_published_at" : "2022-03-12T00:15:00Z"
}
}