CVE-2021-23341: Prismjs Denial of Service Vulnerability
HIGHCVE-2021-23341 is a HIGH denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Prismjs libraries in the npm ecosystem. The issue involves denial of service in prismjs. Remediation is available by upgrading affected packages to version 1.23.0.
CVE-2021-23341 at a Glance
How to Fix CVE-2021-23341
To remediate this vulnerability, upgrade all affected Prismjs 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 prismjs@1.23.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls prismjs
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-23341, inspect your project dependencies using npm:
npm ls prismjs
Analyze the terminal output to locate any version of Prismjs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.23.0), your application is affected.
Note: The npm ls prismjs 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Prismjs, 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-2021-23341 Affected Prismjs Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
prismjs
|
npm |
< 1.23.0
|
1.23.0
|
References
Frequently Asked Questions
What is CVE-2021-23341?
Which Prismjs versions are affected?
What version fixes CVE-2021-23341?
Is prismjs affected?
What CWE is associated with CVE-2021-23341?
How can I check npm dependencies for CVE-2021-23341?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-h4hr-7fg3-h35w",
"modified" : "2023-09-05T22:59:24Z",
"published" : "2021-03-01T19:52:33Z",
"aliases" : [ "CVE-2021-23341" ],
"summary" : "Denial of service in prismjs",
"details" : "The package prismjs before 1.23.0 are vulnerable to Regular Expression Denial of Service (ReDoS) via the `prism-asciidoc`, `prism-rest`, `prism-tap` and `prism-eiffel` components.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "prismjs"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.23.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23341"
}, {
"type" : "WEB",
"url" : "https://github.com/PrismJS/prism/issues/2583"
}, {
"type" : "WEB",
"url" : "https://github.com/PrismJS/prism/pull/2584"
}, {
"type" : "WEB",
"url" : "https://github.com/PrismJS/prism/commit/c2f6a64426f44497a675cb32dccb079b3eff1609"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARS-1076583"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1076582"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JS-PRISMJS-1076581"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/package/prismjs"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-400" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-02-24T07:34:23Z",
"nvd_published_at" : "2021-02-18T16:15:00Z"
}
}