CVE-2022-23631: Superjson Remote Code Execution Vulnerability
CRITICALCVE-2022-23631 is a CRITICAL (CVSS 9.0) remote code execution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Superjson libraries in the npm ecosystem. The issue involves prototype pollution leading to remote code execution in superjson. Remediation is available by upgrading affected packages to version 1.8.1, 0.45.3.
CVE-2022-23631 at a Glance
Security Impact
CVSS: 9.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2022-23631
To remediate this vulnerability, upgrade all affected Superjson 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 superjson@1.8.1
npm install blitz@0.45.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls superjson
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2022-23631, inspect your project dependencies using npm:
npm ls superjson
Analyze the terminal output to locate any version of Superjson in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.8.1), your application is affected.
Note: The npm ls superjson 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 Superjson, 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-23631 Affected Superjson Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
superjson
|
npm |
< 1.8.1
|
1.8.1
|
|
blitz
|
npm |
< 0.45.3
|
0.45.3
|
References
Frequently Asked Questions
What is CVE-2022-23631?
Which Superjson versions are affected?
What version fixes CVE-2022-23631?
Is superjson affected?
Is blitz affected?
What is the CVSS score of CVE-2022-23631?
What CWE is associated with CVE-2022-23631?
How can I check npm dependencies for CVE-2022-23631?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-5888-ffcr-r425",
"modified" : "2023-10-23T19:20:21Z",
"published" : "2022-02-09T22:20:49Z",
"aliases" : [ "CVE-2022-23631" ],
"summary" : "Prototype Pollution leading to Remote Code Execution in superjson",
"details" : "### Impact\n\nThis is critical vulnerability, as it allows to run arbitrary code on any server using superjson input, including a Blitz.js server, without prior authentication or knowledge. Attackers gain full control over the server so they could steal and manipulate data or attack further systems. The only requirement is that the server implements at least one endpoint which uses superjson during request processing. In the case of Blitz.js, it would be at least one RPC call. \n\n### Patches\nThis has been patched in superjson 1.8.1 and Blitz.js 0.45.3. \n\nIf you are unable to upgrade to Blitz.js 0.45.3 in a timely manner, you can instead upgrade only superjson to version 1.8.1 using yarn resolutions are similar. Blitz versions < 0.45.3 are only affected because they used superjson versions < 1.8.1.\n\n### Workarounds\nNone\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in https://github.com/blitz-js/superjson\n* Email us at b@bayer.ws\n\n### References\n* https://www.sonarsource.com/blog/blitzjs-prototype-pollution/",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "superjson"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.8.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "blitz"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.45.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/blitz-js/superjson/security/advisories/GHSA-5888-ffcr-r425"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-23631"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-5888-ffcr-r425"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/blitz-js/superjson"
}, {
"type" : "WEB",
"url" : "https://www.sonarsource.com/blog/blitzjs-prototype-pollution"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1321", "CWE-94" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2022-02-09T22:20:49Z",
"nvd_published_at" : "2022-02-09T22:15:00Z"
}
}