Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker who controls Markdown passed to MDEx.stream/2 to exhaust CPU via unmatched HTML closing tags.

MDEx.stream/2 tracks open HTML tags with MDEx.FragmentParser.continue_html_context/2 in lib/mdex/fragment_parser.ex. Every non-void opening tag is pushed onto an unbounded list, and close_html_tag/2 scans the whole list for each closing tag. A closer with no matching opener leaves the list unchanged, so the next closer scans it again. An HTML block of N openers followed by N unmatched closers therefore costs O(N²), and about 270 KB of input keeps a scheduler busy for tens of seconds. The tracking runs on every HTML block and inline HTML literal regardless of the auto_close option and the render unsafe setting. MDEx.to_html/1 and the other non-streaming entry points are not affected.

This issue affects mdex: from 0.14.0 before 0.15.0.

Project Subscriptions

Vendors Products
Leandrocp Subscribe
Advisories

No advisories yet.

Fixes

Solution

No solution given by the vendor.


Workaround

No workaround given by the vendor.

History

Mon, 30 Nov 2026 19:00:00 +0000

Type Values Removed Values Added
Description Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker who controls Markdown passed to MDEx.stream/2 to exhaust CPU via unmatched HTML closing tags. MDEx.stream/2 tracks open HTML tags with MDEx.FragmentParser.continue_html_context/2 in lib/mdex/fragment_parser.ex. Every non-void opening tag is pushed onto an unbounded list, and close_html_tag/2 scans the whole list for each closing tag. A closer with no matching opener leaves the list unchanged, so the next closer scans it again. An HTML block of N openers followed by N unmatched closers therefore costs O(N²), and about 270 KB of input keeps a scheduler busy for tens of seconds. The tracking runs on every HTML block and inline HTML literal regardless of the auto_close option and the render unsafe setting. MDEx.to_html/1 and the other non-streaming entry points are not affected. This issue affects mdex: from 0.14.0 before 0.15.0.
Title Quadratic HTML tag tracking in MDEx.stream/2 allows CPU exhaustion via unmatched closing tags
First Time appeared Leandrocp
Leandrocp mdex
Weaknesses CWE-407
CPEs cpe:2.3:a:leandrocp:mdex:*:*:*:*:*:*:*:*
Vendors & Products Leandrocp
Leandrocp mdex
References
Metrics cvssV4_0

{'score': 6.9, 'vector': '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'}


Projects

Sign in to view the affected projects.

cve-icon MITRE

Status: PUBLISHED

Assigner: EEF

Published:

Updated: 2026-11-30T18:43:11.147Z

Reserved: 2026-11-30T16:56:06.346Z

Link: CVE-2026-134915

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-11-30T19:17:47.130

Modified: 2026-11-30T19:17:47.130

Link: CVE-2026-134915

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

No data.

Weaknesses