Vulnerabilities in pkg:npm/remark-html

PACKAGE
Advisory Identifier: GHSA-9q5w-79cv-947m
Advisory Summary

CVE-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.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/remark-html

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/remark-html. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-9q5w-79cv-947m CVE-2021-39199 CRITICAL Unsafe defaults in `remark-html`

CVE-2021-39199 at a Glance

CVE Identifier CVE-2021-39199
GHSA Identifier GHSA-9q5w-79cv-947m
Severity CRITICAL
CVSS v3.1 Base Score 10.0
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Remark html
Package Ecosystem npm
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (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.

remark-html fixed: 13.0.2
npm install remark-html@13.0.2
remark-html fixed: 14.0.1
npm install remark-html@14.0.1
Verify Direct and Transitive Dependencies

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

### Impact The 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. ### Patches The 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. ### Workarounds On older affected versions, pass `sanitize: true`, like so: ```diff - .use(remarkHtml) + .use(remarkHtml, {sanitize: true}) ``` ### References n/a ### For more information If you have any questions or comments about this advisory: * Open an issue in [`remark-html`](https://github.com/remarkjs/remark-html) * Email us at [security@unifiedjs.com](mailto:security@unifiedjs.com)

CVE-2021-39199 Affected Remark html Versions

2 component(s)
Fixed Versions:
13.0.214.0.1
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?
CVE-2021-39199 is a security vulnerability in Remark html involving Unsafe defaults in `remark-html` under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Remark html versions are affected?
Affected versions include releases prior to 13.0.2, 14.0.1 across affected packages: remark-html.
What version fixes CVE-2021-39199?
Upgrading to 13.0.2, 14.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is remark-html affected?
Yes, remark-html is affected in releases prior to 13.0.2, 14.0.1. Upgrade your dependency to 13.0.2, 14.0.1 or later.
What is the CVSS score of CVE-2021-39199?
CVE-2021-39199 has a CVSS v3.1 base score of 10.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2021-39199?
CVE-2021-39199 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (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.).
How can I check npm dependencies for CVE-2021-39199?
Run the dependency tree command: 'npm ls remark-html'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}