Skip to main content

CVE-2022-21680: CWE-400: Uncontrolled Resource Consumption in markedjs marked

Medium
Published: Fri Jan 14 2022 (01/14/2022, 00:00:00 UTC)
Source: CVE
Vendor/Project: markedjs
Product: marked

Description

Marked is a markdown parser and compiler. Prior to version 4.0.10, the regular expression `block.def` may cause catastrophic backtracking against some strings and lead to a regular expression denial of service (ReDoS). 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

AILast updated: 06/22/2025, 04:19:57 UTC

Technical Analysis

CVE-2022-21680 is a vulnerability identified in the markedjs project, specifically affecting versions of the 'marked' markdown parser and compiler prior to 4.0.10. The root cause is a flaw in the regular expression named 'block.def', which is used internally to parse markdown content. This regular expression can exhibit catastrophic backtracking behavior when processing certain crafted input strings, leading to a Regular Expression Denial of Service (ReDoS) condition. In practical terms, an attacker can supply maliciously crafted markdown content that triggers excessive CPU consumption during parsing, effectively exhausting system resources and causing service degradation or downtime. The vulnerability is categorized under CWE-400 (Uncontrolled Resource Consumption) and CWE-1333 (Inefficient Regular Expression Complexity). Exploitation does not require authentication but does require the application to process untrusted markdown input using a vulnerable version of marked without protective measures such as worker threads with timeouts. The issue was addressed and patched in version 4.0.10 of marked. No known exploits have been reported in the wild as of the published date. The vulnerability primarily impacts applications and services that accept and render markdown content from untrusted sources using the affected versions of marked, potentially including web applications, content management systems, and developer tools that rely on this library for markdown processing.

Potential Impact

For European organizations, the impact of this vulnerability can be significant in environments where markdown content is processed dynamically, especially in SaaS platforms, developer collaboration tools, documentation portals, and content management systems. Successful exploitation can lead to denial of service conditions, resulting in service outages, degraded user experience, and potential operational disruptions. This can affect confidentiality indirectly if service interruptions prevent timely access to information or disrupt security monitoring tools. Integrity is less directly impacted, as the vulnerability does not allow code execution or data manipulation but could be leveraged as part of a broader attack chain. Availability is the primary concern due to resource exhaustion. Organizations in sectors with high reliance on markdown-based documentation or collaboration tools—such as technology firms, media companies, and public sector entities—may experience operational risks. Additionally, prolonged denial of service can lead to reputational damage and financial losses, especially if critical services are affected.

Mitigation Recommendations

To mitigate this vulnerability, European organizations should: 1) Upgrade all instances of the marked library to version 4.0.10 or later to apply the official patch that resolves the catastrophic backtracking issue. 2) Implement input validation and sanitization to restrict or scrutinize markdown content from untrusted sources before processing. 3) Where upgrading is not immediately feasible, run markdown parsing operations within isolated worker threads or sandboxed environments with strict execution time limits to prevent resource exhaustion. 4) Monitor application performance metrics and set alerts for unusual CPU or memory usage spikes that may indicate attempted exploitation. 5) Review and update security policies to limit exposure of markdown processing endpoints to trusted users or networks where possible. 6) Conduct regular dependency audits to identify and remediate vulnerable library versions. 7) Educate development teams about the risks of ReDoS and encourage secure coding practices around regular expression usage.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2021-11-16T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9848c4522896dcbf6132

Added to database: 5/21/2025, 9:09:28 AM

Last enriched: 6/22/2025, 4:19:57 AM

Last updated: 8/8/2025, 7:22:33 PM

Views: 17

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats