Vulnerabilities in pkg:npm/marked
PACKAGECVE-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.
pkg:npm/marked
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
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).
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.
npm install marked@18.0.2
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
CVE-2026-41680 Affected Marked Versions
1 component(s)| 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?
Which Marked versions are affected?
What version fixes CVE-2026-41680?
Is marked affected?
What is the CVSS score of CVE-2026-41680?
What CWE is associated with CVE-2026-41680?
How can I check npm dependencies for CVE-2026-41680?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}