CVE-2026-54888: CWE-674 Uncontrolled Recursion in leandrocp mdex
Uncontrolled Recursion vulnerability in leandrocp mdex allows denial of service via deeply nested Markdown input. mdex converts between an Elixir %MDEx.Document{} struct and Comrak's internal AST using two mutually recursive Rust functions, ex_document_to_comrak_ast and comrak_ast_to_ex_document, in the NIF source file document.rs. Neither function enforces a maximum nesting depth, so the recursion depth is bounded only by the structure of the input. An attacker who can get a Markdown document rendered (for example through MDEx.parse_document!/1 or MDEx.to_html/1) can supply a document with thousands of nested block quotes, which drives unbounded recursion across the NIF boundary and exhausts the native C stack. Because the resulting stack overflow is an uncatchable SIGSEGV raised inside a NIF, it cannot be contained by the Erlang runtime. It terminates the operating system process running the BEAM, killing every Elixir and Erlang process on the node, not just the caller that triggered the render. No authentication or special privileges are required. The vulnerable conversion code was extracted from mdex into the separate mdex_native package starting in mdex 0.12.3. This issue affects mdex from 0.3.0 before 0.12.3 and mdex_native from 0.1.0 before 0.2.3.
AI Analysis
Technical Summary
The vulnerability in mdex involves two mutually recursive Rust functions, ex_document_to_comrak_ast and comrak_ast_to_ex_document, which convert between Elixir %MDEx.Document{} structs and Comrak's internal AST. These functions do not limit recursion depth, allowing an attacker to supply Markdown documents with thousands of nested block quotes. This unbounded recursion causes a stack overflow in the native code, resulting in an uncatchable SIGSEGV inside a NIF (Native Implemented Function). The Erlang runtime cannot contain this fault, causing the entire BEAM process to terminate and killing all Elixir and Erlang processes on the node. The vulnerability affects mdex versions >=0.3.0 and <0.12.3 and mdex_native versions >=0.1.0 and <0.2.3. There is no indication of a vendor-provided patch or remediation level in the provided data.
Potential Impact
Exploitation of this vulnerability allows an attacker to cause a denial of service by crashing the BEAM virtual machine process hosting Elixir and Erlang applications. This results in a complete termination of all running processes on the node, not just the one processing the malicious Markdown input. No authentication or special privileges are required, increasing the risk of exploitation in environments where untrusted Markdown input is rendered.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, avoid rendering untrusted Markdown input with affected versions of mdex and mdex_native. Consider implementing input validation or limiting Markdown nesting depth externally if possible. Monitor vendor channels for updates regarding patches or official mitigations.
CVE-2026-54888: CWE-674 Uncontrolled Recursion in leandrocp mdex
Description
Uncontrolled Recursion vulnerability in leandrocp mdex allows denial of service via deeply nested Markdown input. mdex converts between an Elixir %MDEx.Document{} struct and Comrak's internal AST using two mutually recursive Rust functions, ex_document_to_comrak_ast and comrak_ast_to_ex_document, in the NIF source file document.rs. Neither function enforces a maximum nesting depth, so the recursion depth is bounded only by the structure of the input. An attacker who can get a Markdown document rendered (for example through MDEx.parse_document!/1 or MDEx.to_html/1) can supply a document with thousands of nested block quotes, which drives unbounded recursion across the NIF boundary and exhausts the native C stack. Because the resulting stack overflow is an uncatchable SIGSEGV raised inside a NIF, it cannot be contained by the Erlang runtime. It terminates the operating system process running the BEAM, killing every Elixir and Erlang process on the node, not just the caller that triggered the render. No authentication or special privileges are required. The vulnerable conversion code was extracted from mdex into the separate mdex_native package starting in mdex 0.12.3. This issue affects mdex from 0.3.0 before 0.12.3 and mdex_native from 0.1.0 before 0.2.3.
CVSS v4.0
Score 6.9medium
Affected software
cpe:2.3:a:leandrocp:mdex:*:*:*:*:*:*:*:*cpe:2.3:a:leandrocp:mdex_native:*:*:*:*:*:*:*:*Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in mdex involves two mutually recursive Rust functions, ex_document_to_comrak_ast and comrak_ast_to_ex_document, which convert between Elixir %MDEx.Document{} structs and Comrak's internal AST. These functions do not limit recursion depth, allowing an attacker to supply Markdown documents with thousands of nested block quotes. This unbounded recursion causes a stack overflow in the native code, resulting in an uncatchable SIGSEGV inside a NIF (Native Implemented Function). The Erlang runtime cannot contain this fault, causing the entire BEAM process to terminate and killing all Elixir and Erlang processes on the node. The vulnerability affects mdex versions >=0.3.0 and <0.12.3 and mdex_native versions >=0.1.0 and <0.2.3. There is no indication of a vendor-provided patch or remediation level in the provided data.
Potential Impact
Exploitation of this vulnerability allows an attacker to cause a denial of service by crashing the BEAM virtual machine process hosting Elixir and Erlang applications. This results in a complete termination of all running processes on the node, not just the one processing the malicious Markdown input. No authentication or special privileges are required, increasing the risk of exploitation in environments where untrusted Markdown input is rendered.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, avoid rendering untrusted Markdown input with affected versions of mdex and mdex_native. Consider implementing input validation or limiting Markdown nesting depth externally if possible. Monitor vendor channels for updates regarding patches or official mitigations.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- EEF
- Date Reserved
- 2026-06-16T10:47:13.915Z
- Cvss Version
- 4.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a42c94c27e9c797196503dc
Added to database: 06/29/2026, 19:36:44 UTC
Last enriched: 06/29/2026, 19:51:34 UTC
Last updated: 06/29/2026, 20:59:26 UTC
Views: 5
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.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.