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 mdex library for Elixir uses two mutually recursive Rust functions in its NIF implementation to convert between Elixir %MDEx.Document{} structs and Comrak's internal AST. These functions, ex_document_to_comrak_ast and comrak_ast_to_ex_document, do not limit recursion depth, allowing an attacker to craft Markdown documents with excessive nesting (e.g., thousands of nested block quotes). This leads to unbounded recursion and stack overflow in native code, causing a SIGSEGV that crashes the BEAM virtual machine process. The crash affects the entire Erlang/Elixir node, not just the invoking process. The vulnerability requires no privileges and can be triggered by any user able to render Markdown via MDEx.parse_document!/1 or MDEx.to_html/1. The issue exists in mdex versions >=0.3.0 and <0.12.3 and in mdex_native >=0.1.0 and <0.2.3.
Potential Impact
Exploitation results in a denial of service by crashing the entire BEAM virtual machine process running Elixir and Erlang applications on the affected node. This is due to an uncatchable segmentation fault caused by stack overflow in native code. The impact is high availability disruption, affecting all processes on the node, with no need for authentication or special privileges.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. No official fix or patch is documented in the provided data. Until a patch is available, avoid rendering untrusted Markdown input with mdex or mdex_native versions affected by this vulnerability. Consider applying input validation or limiting recursion depth externally if possible.
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 mdex library for Elixir uses two mutually recursive Rust functions in its NIF implementation to convert between Elixir %MDEx.Document{} structs and Comrak's internal AST. These functions, ex_document_to_comrak_ast and comrak_ast_to_ex_document, do not limit recursion depth, allowing an attacker to craft Markdown documents with excessive nesting (e.g., thousands of nested block quotes). This leads to unbounded recursion and stack overflow in native code, causing a SIGSEGV that crashes the BEAM virtual machine process. The crash affects the entire Erlang/Elixir node, not just the invoking process. The vulnerability requires no privileges and can be triggered by any user able to render Markdown via MDEx.parse_document!/1 or MDEx.to_html/1. The issue exists in mdex versions >=0.3.0 and <0.12.3 and in mdex_native >=0.1.0 and <0.2.3.
Potential Impact
Exploitation results in a denial of service by crashing the entire BEAM virtual machine process running Elixir and Erlang applications on the affected node. This is due to an uncatchable segmentation fault caused by stack overflow in native code. The impact is high availability disruption, affecting all processes on the node, with no need for authentication or special privileges.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. No official fix or patch is documented in the provided data. Until a patch is available, avoid rendering untrusted Markdown input with mdex or mdex_native versions affected by this vulnerability. Consider applying input validation or limiting recursion depth externally if possible.
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: 07/06/2026, 22:43:09 UTC
Last updated: 08/13/2026, 12:41:11 UTC
Views: 82
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.