Quadratic CPU consumption in mdex auto-close block quote prefix expansion
- State
- Published
- Severity
- 2.1 Low
- Published
- Nov 30, 2026
- Updated
- Nov 30, 2026
- Reserved
- Nov 30, 2026
Description
Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker who supplies Markdown to exhaust CPU via a long run of block quote markers when auto-close is enabled.
When Markdown is rendered with auto_close: true or through MDEx.stream/2, MDEx.FragmentParser checks whether the last paragraph ends in an incomplete link reference definition. If that paragraph contains >, each line's leading quote prefix is expanded by expand_quote_prefix/2 in lib/mdex/fragment_parser.ex. That function is body-recursive and prepends each character to the prefix built so far, copying it again for every leading space, tab or >, so a line of N such bytes costs O(N²). The prefix length is not bounded. A single line of a few hundred kilobytes of > ties up a scheduler for seconds, while the same input renders in milliseconds with auto-close off.
This issue affects mdex: from 0.14.2 before 0.15.0.
| Product | Versions |
|---|---|
| mdex leandrocp | 0.14.2 to before 0.15.0 Affected |
| mdex leandrocp | 9a4b76802bfcd12ba34337bf3cf7d62621d0fe92 to before 2c29b28cd0473c24347aa00b95d16f9ce5f9d9af Affected |
| CVSS | Score | How It's Reached | Source |
|---|---|---|---|
| 4.0 | 2.1 Low | EEF |
Weaknesses
- CWE-407 Inefficient Algorithmic Complexity
References
- EEF CNA record for CVE-2026-137162RelatedThird-Party Advisory
- OSV record EEF-CVE-2026-137162Related
- Introducing commit 9a4b768 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.