CVE-2021-23346: Html parse stringify Denial of Service Vulnerability
MODERATECVE-2021-23346 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Html parse stringify libraries in the npm ecosystem. The issue involves html-parse-stringify and html-parse-stringify2 vulnerable to regular expression denial of service (redos). Remediation is available by upgrading affected packages to version 2.0.1.
CVE-2021-23346 at a Glance
Security Impact
CVSS: 5.3
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:U/C:N/I:N/A:L).
How to Fix CVE-2021-23346
To remediate this vulnerability, upgrade all affected Html parse stringify 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 html-parse-stringify@2.0.1
npm install html-parse-stringify2@Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls html-parse-stringify
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-23346, inspect your project dependencies using npm:
npm ls html-parse-stringify
Analyze the terminal output to locate any version of Html parse stringify in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.1), your application is affected.
Note: The npm ls html-parse-stringify 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 Html parse stringify, 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-23346 Affected Html parse stringify Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
html-parse-stringify
|
npm |
< 2.0.1
|
2.0.1
|
|
html-parse-stringify2
|
npm |
≤ 2.0.1
|
|
References
Frequently Asked Questions
What is CVE-2021-23346?
Which Html parse stringify versions are affected?
What version fixes CVE-2021-23346?
Is html-parse-stringify affected?
Is html-parse-stringify2 affected?
What is the CVSS score of CVE-2021-23346?
What CWE is associated with CVE-2021-23346?
How can I check npm dependencies for CVE-2021-23346?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-545q-3fg6-48m7",
"modified" : "2023-09-12T20:51:14Z",
"published" : "2021-03-18T19:39:31Z",
"aliases" : [ "CVE-2021-23346" ],
"summary" : "html-parse-stringify and html-parse-stringify2 vulnerable to Regular expression denial of service (ReDoS)",
"details" : "This affects the package html-parse-stringify before 2.0.1; all versions of package html-parse-stringify2. Sending certain input could cause one of the regular expressions that is used for parsing to backtrack, freezing the process.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "html-parse-stringify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.0.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "html-parse-stringify2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "2.0.1"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23346"
}, {
"type" : "WEB",
"url" : "https://github.com/HenrikJoreteg/html-parse-stringify/commit/c7274a48e59c92b2b7e906fedf9065159e73fe12"
}, {
"type" : "WEB",
"url" : "https://github.com/HenrikJoreteg/html-parse-stringify/blob/master/lib/parse.js%23L2"
}, {
"type" : "WEB",
"url" : "https://github.com/HenrikJoreteg/html-parse-stringify/releases/tag/v2.0.1"
}, {
"type" : "WEB",
"url" : "https://github.com/rayd/html-parse-stringify2/blob/master/lib/parse.js%23L2"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1080633"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JS-HTMLPARSESTRINGIFY-1079306"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JS-HTMLPARSESTRINGIFY2-1079307"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-400" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-03-12T23:03:51Z",
"nvd_published_at" : "2021-03-04T17:15:00Z"
}
}