Vulnerabilities in pkg:npm/marked

PACKAGE
Advisory Identifier: GHSA-6v9c-7cg6-27q7
Advisory Summary

CVE-2026-41680 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Marked libraries in the npm ecosystem. The issue involves marked vulnerable to oom denial of service via infinite recursion in marked tokenizer. Remediation is available by upgrading affected packages to version 18.0.2.

18 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/marked

18 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-6v9c-7cg6-27q7 CVE-2026-41680 HIGH Marked Vulnerable to OOM Denial of Service via Infinite Recursion in marked Tokenizer
GHSA-p9wx-2529-fp83 CVE-2018-25110 MODERATE Marked allows Regular Expression Denial of Service (ReDoS) attacks
GHSA-32vw-r77c-gm67 - MODERATE Withdrawn Advisory: marked cross-site scripting vulnerability
GHSA-hjcp-j389-59ff CVE-2015-8854 HIGH Regular Expression Denial of Service in marked
GHSA-7px7-7xjx-hxm8 CVE-2017-1000427 MODERATE Marked vulnerable to XSS from data URIs
GHSA-vfvf-mqq8-rwqc CVE-2016-10531 MODERATE Sanitization bypass using HTML Entities in marked
GHSA-x5pg-88wf-qq4p CVE-2017-16114 HIGH Regular Expression Denial of Service in marked
GHSA-xf5p-87ch-gxw2 - MODERATE Marked ReDoS due to email addresses being evaluated in quadratic time
GHSA-5v2h-r2cx-5xgj CVE-2022-21681 HIGH Inefficient Regular Expression Complexity in marked
GHSA-rrrm-qjm4-v8hf CVE-2022-21680 HIGH Inefficient Regular Expression Complexity in marked
GHSA-crmx-v835-hcp4 CVE-2017-17461 MODERATE Moderate severity vulnerability that affects marked
GHSA-9cw2-jqp5-7x39 CVE-2014-3743 MODERATE Multiple Content Injection Vulnerabilities in marked
GHSA-cfjh-p3g4-3q2f CVE-2015-1370 MODERATE VBScript Content Injection in marked
GHSA-wjmf-58vc-xqjr - MODERATE Content injection in marked
GHSA-7m7q-q53v-j47v - MODERATE Regular Expression Denial of Service
GHSA-8wp3-cp9v-44fm - MODERATE Cross-Site Scripting in marked
GHSA-4r62-v4vq-hr96 CVE-2021-21306 MODERATE Regular Expression Denial of Service (REDoS) in Marked
GHSA-ch52-vgq2-943f - LOW Regular Expression Denial of Service in marked

CVE-2026-41680 at a Glance

CVE Identifier CVE-2026-41680
GHSA Identifier GHSA-6v9c-7cg6-27q7
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Marked
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-41680

To remediate this vulnerability, upgrade all affected Marked dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

marked fixed: 18.0.2
npm install marked@18.0.2
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 marked

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-41680, inspect your project dependencies using npm:

npm ls marked

Analyze the terminal output to locate any version of Marked in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 18.0.2), your application is affected.

Note: The npm ls marked 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 Marked, 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

### Summary A critical Denial of Service (DoS) vulnerability exists in `marked@18.0.0`. By providing a specific 3-byte input sequence a tab, a vertical tab, and a newline (`\x09\x0b\n`)—an unauthenticated attacker can trigger an infinite recursion loop during parsing. This leads to unbounded memory allocation, causing the host Node.js application to crash via Memory Exhaustion (OOM). ### Details The vulnerability originates in how `marked`'s block tokenizer handles unexpected whitespace characters. 1. **Tab Character (`\x09`) Consumption**: The `space()` tokenizer matches standard whitespace using the regex `/^(?:[ \t]*(?:\n|$))+/`. When parsing the malicious payload (`\x09\x0b\n`), this rule successfully consumes the initial tab character (`\x09`). 2. **Vertical Tab (`\x0b`) Bypass**: The remaining input is now `\x0b\n`. The newline block rule explicitly looks for spaces or standard tabs (`[ \t]`) followed by a newline. Because the vertical tab is a legacy ASCII character not accounted for in this rule, it fails to match. 3. **Fallback to Text Tokenizer**: None of the standard block tokenizers (blockquote, code, heading, etc.) match `\x0b\n`. As a result, the parser falls through to the `text` tokenizer (`/^[^\n]+/`), which matches any character except a newline. 4. **Infinite Recursion**: Inside `blockTokens()`, the `text` tokenizer creates a text token and subsequently calls `inlineTokens()` on the exact same content. Inside `inlineTokens()`, the text rule again matches `\x0b\n` and recursively calls `inlineTokens()`. This creates an inescapable cycle: `blockTokens() → text token → inlineTokens() → text rule matches → inlineTokens() → ...` With each recursive call allocating new token objects and concatenating strings, memory grows indefinitely until the Node.js heap limit is reached. **Vulnerable Code in `lib/marked.esm.js` (Lexer class, `blockTokens()`):** ```javascript // The text tokenizer triggers infinite recursion if(r=this.tokenizer.text(e)) { e=e.substring(r.raw.length); let s=t.at(-1); s?.type==="text"?(s.raw+=(s.raw.endsWith("\n")?"":"\n")+r.raw, s.text+="\n"+r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src=s.text):t.push(r); // ↑ This calls inlineTokens() internally via the text tokenizer, causing the OOM loop continue; } ``` ### PoC This vulnerability can be reproduced using any standard Node.js environment with `marked@18.0.0` installed. 1. Create a file named `poc.js` with the following content: ```javascript const marked = require('marked'); // The vulnerable 3-byte pattern: tab + vertical tab + newline const vulnerableInput = '\x09\x0b\n'; console.log('Attempting to parse malicious payload...'); try { marked.parse(vulnerableInput); } catch(e) { console.log('Error:', e.message); } ``` 2. Run the script: `node poc.js` 3. **Result:** The process will hang briefly as memory spikes, ultimately crashing with: `FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory`. ### Impact This is a High-Severity Denial of Service (DoS) vulnerability via Memory Exhaustion. **Impacted Parties:** Any application, API, chatbot, or documentation system using `marked@18.0.0` (and potentially earlier versions) to parse untrusted user input is vulnerable. Because the payload requires zero authentication and only 3 bytes of data, it requires virtually no resources from the attacker to remotely crash the service and achieve a total loss of availability for the targeted application.

CVE-2026-41680 Affected Marked Versions

1 component(s)
Fixed Versions:
18.0.2
Product / Package Ecosystem Affected Versions Fixed Version
marked
npm
≥ 18.0.0
< 18.0.2
18.0.2

References

Frequently Asked Questions

What is CVE-2026-41680?
CVE-2026-41680 is a security vulnerability in Marked involving Marked Vulnerable to OOM Denial of Service via Infinite Recursion in marked Tokenizer under CWE-400: Uncontrolled Resource Consumption.
Which Marked versions are affected?
Affected versions include releases prior to 18.0.2 across affected packages: marked.
What version fixes CVE-2026-41680?
Upgrading to 18.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is marked affected?
Yes, marked is affected in releases prior to 18.0.2. Upgrade your dependency to 18.0.2 or later.
What is the CVSS score of CVE-2026-41680?
CVE-2026-41680 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-41680?
CVE-2026-41680 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check npm dependencies for CVE-2026-41680?
Run the dependency tree command: 'npm ls marked'. 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-6v9c-7cg6-27q7",
  "modified" : "2026-04-29T22:12:20Z",
  "published" : "2026-04-29T22:12:20Z",
  "aliases" : [ "CVE-2026-41680" ],
  "summary" : "Marked Vulnerable to OOM Denial of Service via Infinite Recursion in marked Tokenizer",
  "details" : "### Summary\nA critical Denial of Service (DoS) vulnerability exists in `marked@18.0.0`. By providing a specific 3-byte input sequence a tab, a vertical tab, and a newline (`\\x09\\x0b\\n`)—an unauthenticated attacker can trigger an infinite recursion loop during parsing. This leads to unbounded memory allocation, causing the host Node.js application to crash via Memory Exhaustion (OOM). \n\n### Details\nThe vulnerability originates in how `marked`'s block tokenizer handles unexpected whitespace characters. \n\n1. **Tab Character (`\\x09`) Consumption**: The `space()` tokenizer matches standard whitespace using the regex `/^(?:[ \\t]*(?:\\n|$))+/`. When parsing the malicious payload (`\\x09\\x0b\\n`), this rule successfully consumes the initial tab character (`\\x09`).\n2. **Vertical Tab (`\\x0b`) Bypass**: The remaining input is now `\\x0b\\n`. The newline block rule explicitly looks for spaces or standard tabs (`[ \\t]`) followed by a newline. Because the vertical tab is a legacy ASCII character not accounted for in this rule, it fails to match.\n3. **Fallback to Text Tokenizer**: None of the standard block tokenizers (blockquote, code, heading, etc.) match `\\x0b\\n`. As a result, the parser falls through to the `text` tokenizer (`/^[^\\n]+/`), which matches any character except a newline.\n4. **Infinite Recursion**: Inside `blockTokens()`, the `text` tokenizer creates a text token and subsequently calls `inlineTokens()` on the exact same content. Inside `inlineTokens()`, the text rule again matches `\\x0b\\n` and recursively calls `inlineTokens()`. This creates an inescapable cycle: `blockTokens() → text token → inlineTokens() → text rule matches → inlineTokens() → ...`\n\nWith each recursive call allocating new token objects and concatenating strings, memory grows indefinitely until the Node.js heap limit is reached.\n\n**Vulnerable Code in `lib/marked.esm.js` (Lexer class, `blockTokens()`):**\n```javascript\n// The text tokenizer triggers infinite recursion\nif(r=this.tokenizer.text(e)) {\n    e=e.substring(r.raw.length);\n    let s=t.at(-1);\n    s?.type===\"text\"?(s.raw+=(s.raw.endsWith(\"\\n\")?\"\":\"\\n\")+r.raw, s.text+=\"\\n\"+r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src=s.text):t.push(r);\n    // ↑ This calls inlineTokens() internally via the text tokenizer, causing the OOM loop\n    continue;\n}\n```\n\n### PoC\nThis vulnerability can be reproduced using any standard Node.js environment with `marked@18.0.0` installed.\n\n1. Create a file named `poc.js` with the following content:\n```javascript\nconst marked = require('marked');\n\n// The vulnerable 3-byte pattern: tab + vertical tab + newline\nconst vulnerableInput = '\\x09\\x0b\\n';\n\nconsole.log('Attempting to parse malicious payload...');\ntry {\n    marked.parse(vulnerableInput);\n} catch(e) {\n    console.log('Error:', e.message);\n}\n```\n2. Run the script: `node poc.js`\n3. **Result:** The process will hang briefly as memory spikes, ultimately crashing with: `FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory`.\n\n### Impact\nThis is a High-Severity Denial of Service (DoS) vulnerability via Memory Exhaustion. \n\n**Impacted Parties:** Any application, API, chatbot, or documentation system using `marked@18.0.0` (and potentially earlier versions) to parse untrusted user input is vulnerable. \n\nBecause the payload requires zero authentication and only 3 bytes of data, it requires virtually no resources from the attacker to remotely crash the service and achieve a total loss of availability for the targeted application.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "marked"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "18.0.0"
      }, {
        "fixed" : "18.0.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 18.0.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/markedjs/marked/security/advisories/GHSA-6v9c-7cg6-27q7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-41680"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/markedjs/marked"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-674", "CWE-835" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-29T22:12:20Z",
    "nvd_published_at" : "2026-04-24T18:16:29Z"
  }
}