Quadratic HTML tag tracking in MDEx.stream/2 allows CPU exhaustion via unmatched closing tags
- State
- Published
- Severity
- 6.9 Medium
- Published
- Nov 30, 2026
- Updated
- Nov 30, 2026
- Reserved
- Nov 30, 2026
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.
| Product | Versions |
|---|---|
| mdex leandrocp | 0.14.0 to before 0.15.0 Affected |
| mdex leandrocp | a88793cb0fc5caf75bf878b92c64d36817824765 to before 2c29b28cd0473c24347aa00b95d16f9ce5f9d9af Affected |
| CVSS | Score | How It's Reached | Source |
|---|---|---|---|
| 4.0 | 6.9 Medium | EEF |
Weaknesses
- CWE-407 Inefficient Algorithmic Complexity
References
- EEF CNA record for CVE-2026-134915RelatedThird-Party Advisory
- OSV record EEF-CVE-2026-134915Related
- Introducing commit a88793c in leandrocp/mdexRelated
- Fix commit 2c29b28 in leandrocp/mdexPatch
Every record here comes from the CVE Program's CVE List. © 1999-2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.