Skip to main content

mdex CVE-2026-54888

| EUVDEUVD-2026-40177 MEDIUM
Uncontrolled Recursion (CWE-674)
2026-06-29 EEF
6.9
CVSS 4.0 · Vendor: EEF
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Submit crafted deeply nested Markdown document
  2. Delivery
    Application calls MDEx.to_html/1 or MDEx.parse_document!/1
  3. Exploit
    NIF invokes mutually recursive Rust AST conversion
  4. Execution
    Recursion depth exceeds native C stack limit
  5. Persist
    SIGSEGV raised inside NIF boundary
  6. Impact
    BEAM VM OS process terminates, killing all node processes

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Recursion depth limits
Exploitation Conditions

The targeted application must use mdex or mdex_native to process Markdown content that is fully or partially attacker-controlled - for example, a blog editor, comment system, documentation renderer, or chat platform where users submit Markdown that is passed to MDEx.parse_document!/1 or MDEx.to_html/1. No authentication, session token, or elevated privileges are required at the mdex library level; the CVSS 4.0 vector confirms PR:N and UI:N. Exploitation is limited to code paths where attacker-supplied content reaches the NIF conversion functions without prior depth or size sanitization. Applications that only render trusted, internally generated Markdown with no external input path are not at risk. The SIGSEGV impact is not bounded to a single request handler or process - any invocation on the node triggers node-wide termination.

Impact

The CNA-assigned CVSS 4.0 vector (AV:L/AC:L/AT:N/PR:N/UI:N/VA:H) scores 6.9, reflecting high availability impact with no complexity or privilege requirements. However, the AV:L choice warrants scrutiny: the description explicitly states no authentication or special privileges are required and identifies mdex.parse_document!/1 and mdex.to_html/1 as entry points, which in typical Phoenix or Plug web applications are reachable from network-provided input. A realistic deployment attack surface is therefore network-vector, not local, and the moderate numeric score understates the operational impact. The blast radius is disproportionate to the raw score - a single crafted HTTP request can terminate an entire BEAM node, simultaneously killing every co-hosted Elixir and Erlang process regardless of their relationship to the caller. There is no CISA KEV listing and no public exploit has been identified at time of analysis; EPSS data was not provided in the available intelligence. From an SSVC perspective the technique is trivially automatable (craft a text file with deeply nested block quotes), the technical impact is total availability loss for the node, and exploitation requires zero complexity beyond knowledge of the public description. Despite the moderate CVSS score, the node-wide crash amplification and the trivially constructable payload elevate real-world priority for any application that exposes mdex rendering to untrusted input.

Exploit ScenarioDerived

An attacker targeting a Phoenix web application or any Elixir service that renders user-supplied Markdown submits an HTTP request containing a document composed of thousands of consecutively nested block quote markers. When the application calls MDEx.to_html/1 or MDEx.parse_document!/1, the NIF's mutually recursive AST conversion exhausts the native C stack, raising a SIGSEGV that the Erlang runtime cannot intercept. The entire BEAM VM process is terminated, simultaneously killing all Elixir and Erlang processes on the node. No public exploit code has been identified at time of analysis, but the attack payload is trivially constructable from the public description alone.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 29, 2026

Stack exhaustion in the mdex and mdex_native Elixir Markdown libraries causes entire-node denial of service when processing attacker-controlled deeply nested Markdown. Two mutually recursive Rust NIF functions, ex_document_to_comrak_ast and comrak_ast_to_ex_document in document.rs, traverse the Comrak AST without enforcing a maximum nesting depth; a document with thousands of nested block quotes drives unbounded recursion that overflows the native C stack. Because the resulting SIGSEGV is raised inside a NIF, the Erlang runtime cannot catch it - the OS process hosting the BEAM terminates, killing every Elixir and Erlang process on the node. No public exploit has been identified at time of analysis, but the attack requires only crafted Markdown input with no authentication.

RemediationAI

Upgrade mdex to version 0.12.3 or later, or mdex_native to version 0.2.3 or later; the upstream fix is available at commit 947696c47bc22bea5dffc0f78c946fa6b70ce183 (https://github.com/leandrocp/mdex_native/commit/947696c47bc22bea5dffc0f78c946fa6b70ce183), with the full advisory at https://github.com/leandrocp/mdex_native/security/advisories/GHSA-3w4f-53g2-f66p. If immediate patching is not feasible, the most effective compensating control is to enforce a maximum nesting depth or document size limit on Markdown input before it reaches any mdex API call - reject or truncate documents exceeding a safe threshold (such as 50 to 100 nesting levels of block quotes or list items) at the application layer; this adds input-validation overhead but prevents unbounded recursion from reaching the NIF boundary. As an architectural mitigation, isolating mdex rendering in a dedicated OTP application or separate OS subprocess with a supervisor that can restart on crash limits the blast radius from node-wide termination to a sandboxed process, though this requires non-trivial architectural changes and does not eliminate the underlying flaw.

Affected VersionsENISA

mdex 0.3.0 <0.12.3
mdex_native 956528c5e31746253347029e810a969ab916fd27 <947696c47bc22bea5dffc0f78c946fa6b70ce183
mdex d0bc7d55177727c61d188ef465178ab3b81f4f2c <6ed94d905f97af188323f042698ae841c02293b4
mdex_native 0.1.0 <0.2.3

Affected Packages

euvd mdex fix: 0.12.3
euvd mdex_native fix: 0.2.3

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The vulnerability resides in the Rust NIF (Native Implemented Function) layer shared between mdex and its extracted sub-package mdex_native. NIFs execute native Rust/C code directly inside the BEAM OS process; unlike Erlang exceptions, signals raised inside NIFs - including SIGSEGV from stack overflow - bypass the Erlang supervisor tree entirely and cannot be isolated. CWE-674 (Uncontrolled Recursion) identifies the root cause: the two mutually recursive functions ex_document_to_comrak_ast and comrak_ast_to_ex_document mirror the AST structure of Comrak, a CommonMark-compliant Rust parser, without imposing any recursion depth limit. Deeply nested Markdown constructs such as cascaded block quotes produce an equally deep AST, and recursion depth scales linearly with nesting, quickly exceeding the native C stack. Affected CPEs are cpe:2.3:a:leandrocp:mdex (versions 0.3.0 through 0.12.2) and cpe:2.3:a:leandrocp:mdex_native (versions 0.1.0 through 0.2.2); the mdex_native package was introduced when the conversion code was refactored out of mdex starting at mdex 0.12.3.

Know when Mdex gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (EEF) PRIMARY 6.9 MEDIUM
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
vuln.today AI 8.6 HIGH

Network vector for typical web-app deployment; scope changed because SIGSEGV inside the NIF terminates the entire BEAM VM, killing all co-hosted processes beyond the direct caller.

3.1 AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:N/A:H
4.0 AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (EEF).

CVSS VectorVendor: EEF

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

DescriptionCVE.org

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.

Threat Intelligence Overview

EPSS Score
0.2%
Top 94% exploitable
Prevalence
Low
niche Elixir Markdown library, limited ecosystem footprint
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
Poc
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

34
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +34
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy