CVE-2022-21681: CWE-400: Uncontrolled Resource Consumption in markedjs marked
Marked is a markdown parser and compiler. Prior to version 4.0.10, the regular expression `inline.reflinkSearch` may cause catastrophic backtracking against some strings and lead to a denial of service (DoS). Anyone who runs untrusted markdown through a vulnerable version of marked and does not use a worker with a time limit may be affected. This issue is patched in version 4.0.10. As a workaround, avoid running untrusted markdown through marked or run marked on a worker thread and set a reasonable time limit to prevent draining resources.
AI Analysis
Technical Summary
CVE-2022-21681 is a vulnerability in the markedjs library, a popular markdown parser and compiler used in numerous web applications and services. The issue arises from the regular expression `inline.reflinkSearch` used in versions of marked prior to 4.0.10. This regex can cause catastrophic backtracking when processing certain specially crafted input strings, leading to uncontrolled resource consumption. Specifically, the vulnerability is classified under CWE-400 (Uncontrolled Resource Consumption) and CWE-1333 (Inefficient Regular Expression Complexity). When untrusted markdown content is parsed by a vulnerable version of marked, the regex engine may enter an exponential backtracking state, consuming excessive CPU and memory resources, which can result in a denial of service (DoS). The vulnerability does not require authentication but does require that the application processes untrusted markdown input without safeguards. The recommended mitigation is to upgrade to marked version 4.0.10 or later, where the regex has been fixed. Alternatively, running the markdown parsing in a worker thread with a strict execution time limit can prevent resource exhaustion. There are no known exploits in the wild, but the vulnerability presents a risk to any service that processes user-supplied markdown using affected versions of marked without proper isolation or timeouts.
Potential Impact
For European organizations, this vulnerability poses a moderate risk primarily to web services and applications that accept and render user-generated markdown content, such as content management systems, developer platforms, documentation portals, and collaboration tools. Successful exploitation can lead to denial of service, causing service outages or degraded performance, which may impact business continuity and user experience. While the vulnerability does not directly compromise confidentiality or integrity, the availability impact can disrupt critical operations, especially for organizations relying on real-time content rendering or collaborative environments. Given the widespread use of JavaScript and markdown in modern web applications, organizations in sectors such as technology, media, education, and government could be affected. The lack of known exploits reduces immediate risk, but the ease of triggering regex backtracking with crafted input means attackers could leverage this vulnerability to launch DoS attacks. Additionally, if markdown rendering is part of automated pipelines or APIs, resource exhaustion could cascade, affecting broader infrastructure.
Mitigation Recommendations
1. Upgrade all instances of marked to version 4.0.10 or later to apply the official patch that resolves the regex inefficiency. 2. If immediate upgrade is not feasible, isolate markdown parsing by running it in dedicated worker threads or separate processes with strict CPU and memory usage limits and enforce execution timeouts to prevent runaway resource consumption. 3. Implement input validation and sanitization to restrict or filter markdown input from untrusted sources, potentially limiting the use of complex link references that trigger the vulnerable regex. 4. Monitor application performance metrics and set alerts for unusual CPU or memory spikes associated with markdown processing components. 5. Conduct code audits and dependency reviews to identify other uses of vulnerable markdown parsers or similar regex patterns. 6. Educate development teams about the risks of regex-based DoS and encourage secure coding practices when handling untrusted input. 7. For web-facing APIs or services, consider rate limiting and request throttling to reduce the impact of potential abuse.
Affected Countries
Germany, United Kingdom, France, Netherlands, Sweden, Finland, Denmark, Ireland
CVE-2022-21681: CWE-400: Uncontrolled Resource Consumption in markedjs marked
Description
Marked is a markdown parser and compiler. Prior to version 4.0.10, the regular expression `inline.reflinkSearch` may cause catastrophic backtracking against some strings and lead to a denial of service (DoS). Anyone who runs untrusted markdown through a vulnerable version of marked and does not use a worker with a time limit may be affected. This issue is patched in version 4.0.10. As a workaround, avoid running untrusted markdown through marked or run marked on a worker thread and set a reasonable time limit to prevent draining resources.
AI-Powered Analysis
Technical Analysis
CVE-2022-21681 is a vulnerability in the markedjs library, a popular markdown parser and compiler used in numerous web applications and services. The issue arises from the regular expression `inline.reflinkSearch` used in versions of marked prior to 4.0.10. This regex can cause catastrophic backtracking when processing certain specially crafted input strings, leading to uncontrolled resource consumption. Specifically, the vulnerability is classified under CWE-400 (Uncontrolled Resource Consumption) and CWE-1333 (Inefficient Regular Expression Complexity). When untrusted markdown content is parsed by a vulnerable version of marked, the regex engine may enter an exponential backtracking state, consuming excessive CPU and memory resources, which can result in a denial of service (DoS). The vulnerability does not require authentication but does require that the application processes untrusted markdown input without safeguards. The recommended mitigation is to upgrade to marked version 4.0.10 or later, where the regex has been fixed. Alternatively, running the markdown parsing in a worker thread with a strict execution time limit can prevent resource exhaustion. There are no known exploits in the wild, but the vulnerability presents a risk to any service that processes user-supplied markdown using affected versions of marked without proper isolation or timeouts.
Potential Impact
For European organizations, this vulnerability poses a moderate risk primarily to web services and applications that accept and render user-generated markdown content, such as content management systems, developer platforms, documentation portals, and collaboration tools. Successful exploitation can lead to denial of service, causing service outages or degraded performance, which may impact business continuity and user experience. While the vulnerability does not directly compromise confidentiality or integrity, the availability impact can disrupt critical operations, especially for organizations relying on real-time content rendering or collaborative environments. Given the widespread use of JavaScript and markdown in modern web applications, organizations in sectors such as technology, media, education, and government could be affected. The lack of known exploits reduces immediate risk, but the ease of triggering regex backtracking with crafted input means attackers could leverage this vulnerability to launch DoS attacks. Additionally, if markdown rendering is part of automated pipelines or APIs, resource exhaustion could cascade, affecting broader infrastructure.
Mitigation Recommendations
1. Upgrade all instances of marked to version 4.0.10 or later to apply the official patch that resolves the regex inefficiency. 2. If immediate upgrade is not feasible, isolate markdown parsing by running it in dedicated worker threads or separate processes with strict CPU and memory usage limits and enforce execution timeouts to prevent runaway resource consumption. 3. Implement input validation and sanitization to restrict or filter markdown input from untrusted sources, potentially limiting the use of complex link references that trigger the vulnerable regex. 4. Monitor application performance metrics and set alerts for unusual CPU or memory spikes associated with markdown processing components. 5. Conduct code audits and dependency reviews to identify other uses of vulnerable markdown parsers or similar regex patterns. 6. Educate development teams about the risks of regex-based DoS and encourage secure coding practices when handling untrusted input. 7. For web-facing APIs or services, consider rate limiting and request throttling to reduce the impact of potential abuse.
Affected Countries
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2021-11-16T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9848c4522896dcbf613a
Added to database: 5/21/2025, 9:09:28 AM
Last enriched: 6/22/2025, 4:19:46 AM
Last updated: 2/7/2026, 12:27:26 PM
Views: 40
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2026-2085: Command Injection in D-Link DWR-M921
HighCVE-2026-2084: OS Command Injection in D-Link DIR-823X
HighCVE-2026-2083: SQL Injection in code-projects Social Networking Site
MediumCVE-2026-2082: OS Command Injection in D-Link DIR-823X
MediumCVE-2026-2080: Command Injection in UTT HiPER 810
HighActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.