2.1low
Quadratic rescanning in MDEx auto-close link scanner allows CPU denial of service
- Severity
- 2.1low CVSS:4.0 by EEF
- Exploit likelihood
- 0.32% (higher than 26% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- EEF
- Also known as
- EEF-CVE-2026-129522
Description
Inefficient Algorithmic Complexity vulnerability in MDEx.FragmentParser in leandrocp mdex allows an attacker who controls streamed or auto-closed Markdown to cause a denial of service through CPU exhaustion. Any application that renders untrusted Markdown with MDEx.stream/2 or the auto_close option is affected, for example live previews or streamed LLM output. While auto-closing the last paragraph, close_bracket/5 in lib/mdex/fragment_parser.ex runs an unbounded forward scan of the link tail for every ](. When that scan finds no valid link, scanning resumes just after the ], so the next ]( rescans the same tail. Each closed link also re-filters every pending image opener. Repeated [](x (, [](x(, or  and documents with auto_close call MDEx.FragmentParser.complete/2, which reaches incomplete_paragraph_link/5 and open_link/5 for the last paragraph. Scanning stops at a blank line, so an attacker who never sends one keeps the whole input in scope.
2. Rescan. For every ](, close_bracket/5 calls link_tail/2, which scans forward without bound through bare_destination/3, link_title_end/4 and link_close/2. When the tail is :invalid, continue_after_link/2 resumes just after the ], so the next ]( rescans the same tail. An unterminated title ([](x ( repeated) or nested parentheses ([](x( repeated) makes every scan run to the end of the paragraph.
3. Opener filtering. Each closed link runs Enum.filter/2 over every pending opener to keep only images. With  z(about 120 KB, no blank line). - Pass it as one chunk to
MDEx.stream/2and consume the stream. - Observe the call take over ten seconds, while
MDEx.to_html!/1on the same input returns in about 10 ms. Doubling the input roughly quadruples the time.
Impact
An attacker who can submit Markdown to a streaming or auto-closing renderer can occupy a CPU scheduler for seconds per request with about 100 KB of input, slowing or denying rendering for other users.
Configurations
The application must render untrusted Markdown with auto-closing enabled: through MDEx.stream/2, where it is on unless auto_close: false is passed, or with the auto_close option set on a document. Rendering with the default options of MDEx.to_html/2 and MDEx.parse_document/2 does not run the affected scanner.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-129522 changed 2026-11-30 | CVE Terms of Use |
| Erlang Ecosystem Foundation | EEF-CVE-2026-129522 changed 2026-11-30 | CC-BY-4.0 |
| NVD | CVE-2026-129522 changed 2026-11-30 | Public domain |