EEF-CVE-2026-54888 CVE-2026-54888 GHSA-3w4f-53g2-f66p
Uncontrolled recursion over deeply nested Markdown crashes the BEAM in mdex
- Severity
- 0.0 / 10
- Unknown · CVSS 4.0
- Exploit chance (EPSS)
- 0.24%
- Chance of exploitation in the next 30 days. Higher than 14.80% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-674 Uncontrolled Recursion
- Fix
- Available
- 2 packages have a fixed version
Description
Summary
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.
Affected versions
Hex
| Package | Vulnerable | Fixed in |
|---|---|---|
| mdex | >= 0.3.0, < 0.12.3 |
0.12.3 |
| mdex_native | >= 0.1.0, < 0.2.3 |
0.2.3 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
mdex Hex → 0.12.3
- mix
{:mdex, "~> 0.12.3"} # then: mix deps.update mdex
mdex_native Hex → 0.2.3
- mix
{:mdex_native, "~> 0.2.3"} # then: mix deps.update mdex_native
Severity breakdown
CVSS 4.0 0.0
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
- Attack vector
- Local
- Attack complexity
- Low
- Attack requirements
- None
- Privileges required
- None
- User interaction
- None
- Confidentiality (vulnerable system)
- None
- Integrity (vulnerable system)
- None
- Availability (vulnerable system)
- High
- Confidentiality (subsequent systems)
- None
- Integrity (subsequent systems)
- None
- Availability (subsequent systems)
- None
Weakness
CWE-674: Uncontrolled Recursion
The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.
How to prevent it
- Implementation: Ensure that an end condition will be reached under all logic conditions. The end condition may include checking against the depth of recursion and exiting with an error if the recursion goes too deep. The complexity of the end condition contributes to the effectiveness of this action.
- Implementation: Increase the stack size.
References
Advisories
Fixes and patches
Packages
Other links
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| EEF-CVE-2026-53426 Atom-table exhaustion denial-of-service via JSON parse_document in MDEx | Not rated yet | Also affects mdex |
| EEF-CVE-2026-54889 Unsanitized URL schemes in MDEx Quill Delta output allow javascript: injection (XSS) | Not rated yet | Also affects mdex |
| EEF-CVE-2026-53429 Unbounded native memory leak in mdex escaped-tag rendering enables unauthenticated denial of service | Not rated yet | Also affects mdex |
| EEF-CVE-2026-53428 Unbounded memory allocation in highlight_lines range expansion in mdex | Not rated yet | Also affects mdex |
| EEF-CVE-2026-53427 Cross-site scripting in MDEx via unescaped highlight_lines_class code-fence attribute | Not rated yet | Also affects mdex |
| GHSA-hqq3-7jhf-c5jx Forge: Denial of service in TLS record processing via call stack exhaustion | High | Same weakness, CWE-674 |
| GHSA-wwpr-jff3-395c Crass: A large number of adjacent CSS comments can trigger a SystemStackError | Medium | Same weakness, CWE-674 |
| GHSA-6jxj-px6v-747w Crass: Deeply nested CSS blocks and functions can trigger a SystemStackError or excessive memory usage | Medium | Same weakness, CWE-674 |
Credits: Jonatan Männchen / EEF, Leandro Pereira, Peter Ullrich
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor