CVE-2021-39199: Remark html Unsafe Defaults Vulnerability
CRITICALCVE-2021-39199 is a CRITICAL (CVSS 10.0) unsafe defaults vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Remark html libraries in the npm ecosystem. The issue involves unsafe defaults in `remark-html`. Remediation is available by upgrading affected packages to version 13.0.2, 14.0.1.
CVE-2021-39199 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:N).
How to Fix CVE-2021-39199
To remediate this vulnerability, upgrade all affected Remark html 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 remark-html@13.0.2
npm install remark-html@14.0.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls remark-html
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-39199, inspect your project dependencies using npm:
npm ls remark-html
Analyze the terminal output to locate any version of Remark html in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 13.0.2), your application is affected.
Note: The npm ls remark-html 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Remark html, 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-39199 Affected Remark html Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
remark-html
|
npm |
< 13.0.2
|
13.0.2
|
|
remark-html
|
npm |
≥ 14.0.0
< 14.0.1
All 1 versions
14.0.0
|
14.0.1
|
References
Frequently Asked Questions
What is CVE-2021-39199?
Which Remark html versions are affected?
What version fixes CVE-2021-39199?
Is remark-html affected?
What is the CVSS score of CVE-2021-39199?
What CWE is associated with CVE-2021-39199?
How can I check npm dependencies for CVE-2021-39199?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-9q5w-79cv-947m",
"modified" : "2021-09-07T19:05:40Z",
"published" : "2021-09-07T23:10:56Z",
"aliases" : [ "CVE-2021-39199" ],
"summary" : "Unsafe defaults in `remark-html`",
"details" : "### Impact\n\nThe documentation of `remark-html` has mentioned that it was safe by default. In practise the default was never safe and had to be opted into. This means arbitrary HTML can be passed through leading to potential XSS attacks.\n\n### Patches\n\nThe problem has been patched in 13.0.2 and 14.0.1: `remark-html` is now safe by default, and the implementation matches the documentation.\n\n### Workarounds\n\nOn older affected versions, pass `sanitize: true`, like so:\n\n```diff\n- .use(remarkHtml)\n+ .use(remarkHtml, {sanitize: true})\n```\n\n### References\n\nn/a\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in [`remark-html`](https://github.com/remarkjs/remark-html)\n* Email us at [security@unifiedjs.com](mailto:security@unifiedjs.com)\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "remark-html"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "13.0.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "remark-html"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "14.0.0"
}, {
"fixed" : "14.0.1"
} ]
} ],
"versions" : [ "14.0.0" ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/remarkjs/remark-html/security/advisories/GHSA-9q5w-79cv-947m"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-39199"
}, {
"type" : "WEB",
"url" : "https://github.com/remarkjs/remark-html/commit/b75c9dde582ad87ba498e369c033dc8a350478c1"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/remarkjs/remark-html"
}, {
"type" : "WEB",
"url" : "https://github.com/remarkjs/remark-html/releases/tag/14.0.1"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/package/remark-html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2021-09-07T19:05:40Z",
"nvd_published_at" : "2021-09-07T19:15:00Z"
}
}