EEF-CVE-2026-135775

Source
https://cna.erlef.org/osv/EEF-CVE-2026-135775.html
Import Source
https://cna.erlef.org/osv/EEF-CVE-2026-135775.json
JSON Data
https://api.osv.dev/v1/vulns/EEF-CVE-2026-135775
Aliases
  • CVE-2026-135775
Published
2026-11-30T18:45:07Z
Modified
2026-11-30T19:00:03Z
Severity
  • 5.9 (Medium) CVSS_V4 - CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N (Source: CNA) CVSS Calculator
Summary
Quadratic CPU consumption in mdex auto-close trimming of trailing parentheses after bare URLs
Details

Summary

Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker who controls rendered Markdown to cause a denial of service via a bare URL followed by many closing parentheses.

When auto-close is active, MDEx.FragmentParser.autolink_size/2 in lib/mdex/fragment_parser.ex trims trailing ) from a bare URL one byte at a time and recounts every ( and ) in the remaining URL at each step, so a URL followed by N parentheses costs O(N²) work. Around 20 KB of input pins a scheduler for tens of seconds, and MDEx.stream/2 repeats the completion over the whole accumulated source for every chunk. No extension needs to be enabled. Rendering with auto-close disabled is not affected.

This issue affects mdex: from 0.14.2 before 0.15.0.

Details

1. Reaching the trimmer. With auto-close active, MDEx.FragmentParser.complete/2 runs complete_inline/3, which calls unmatched_suffix/1. That masks bare URLs through mask_urls/1 and mask_url_spans/4, and each URL span is measured with autolink_text/1. No extension needs to be enabled.

2. Quadratic trim. autolink_size/2 walks back from the end of the URL candidate. For every trailing ) it takes the remaining prefix, counts all ( and all ) in it with count_char/2, and if closers outnumber openers it drops one byte and recurses. A URL followed by N ) therefore performs N full scans of a string of length up to N, which is O(N²).

3. Amplification. MDEx.stream/2 re-runs completion over the whole accumulated source for every chunk, so a payload delivered over many chunks multiplies the cost. None of the entry points limits input size.

Proof of concept

  1. Build the input "http://x" followed by 15,000 ) characters (about 15 KB).
  2. Render it with MDEx.to_html!(markdown): it completes in a few milliseconds.
  3. Render the same input with MDEx.to_html!(markdown, auto_close: true), or pass it as a single chunk to MDEx.stream/2: rendering takes tens of seconds and holds a scheduler for the whole time.
  4. Doubling the number of parentheses roughly quadruples the time.

Impact

An attacker who can supply Markdown, or steer LLM output, that an application renders with auto-close can pin BEAM schedulers with a few kilobytes of input per request, delaying or denying service to every other user of the node.

Workarounds

Render untrusted Markdown with auto-close disabled: pass auto_close: false to MDEx.stream/2, and do not pass auto_close: true to MDEx.to_html/2 or the other renderers.

Configurations

The vulnerable code runs only when auto-close is active: in MDEx.stream/2, where auto_close defaults to true; in MDEx.to_html/2 and the other renderers when called with auto_close: true; and in MDEx.Document streaming buffers with auto_close set. Rendering with the default options of MDEx.to_html/2 does not reach it.

Database specific
{
    "$schema":  "https://cna.erlef.org/schemas/osv/record-0.1.0.json",
    "capec_ids":  [
        "CAPEC-130"
    ],
    "cpe_ids":  [
        "cpe:2.3:a:leandrocp:mdex:*:*:*:*:*:*:*:*"
    ],
    "cwe_ids":  [
        "CWE-407"
    ]
}
References
Credits
    • Peter Ullrich - FINDER
    • Peter Ullrich - REPORTER
    • Jonatan Männchen / EEF - ANALYST
    • Leandro Pereira - REMEDIATION_DEVELOPER

Affected packages

Hex / mdex

Package

Name
mdex
Purl
pkg:hex/mdex

Affected ranges

Type
SEMVER
Events
Introduced
0.14.2
Fixed
0.15.0

Affected versions

0.*
0.14.2
0.14.3
0.14.4
0.14.5
0.14.6
0.14.7
0.14.8
0.14.9

Ecosystem specific

{
    "$schema":  "https://cna.erlef.org/schemas/osv/affected-0.1.0.json",
    "modules":  [
        "'Elixir.MDEx.FragmentParser'",
        "'Elixir.MDEx'"
    ],
    "program_files":  [
        "lib/mdex/fragment_parser.ex",
        "lib/mdex.ex"
    ],
    "program_routines":  [
        "'Elixir.MDEx.FragmentParser':autolink_size/2",
        "'Elixir.MDEx.FragmentParser':autolink_text/1",
        "'Elixir.MDEx.FragmentParser':complete/2",
        "'Elixir.MDEx.FragmentParser':complete_with_state/3",
        "'Elixir.MDEx':stream/2",
        "'Elixir.MDEx':to_html/2"
    ]
}

Database specific

$schema
"https://cna.erlef.org/schemas/osv/affected-0.1.0.json"
modules
[
    "'Elixir.MDEx.FragmentParser'",
    "'Elixir.MDEx'"
]
program_files
[
    "lib/mdex/fragment_parser.ex",
    "lib/mdex.ex"
]
program_routines
[
    "'Elixir.MDEx.FragmentParser':autolink_size/2",
    "'Elixir.MDEx.FragmentParser':autolink_text/1",
    "'Elixir.MDEx.FragmentParser':complete/2",
    "'Elixir.MDEx.FragmentParser':complete_with_state/3",
    "'Elixir.MDEx':stream/2",
    "'Elixir.MDEx':to_html/2"
]
source
"https://cna.erlef.org/osv/EEF-CVE-2026-135775.json"

Git / github.com/leandrocp/mdex

Affected ranges

Type
GIT
Repo
https://github.com/leandrocp/mdex
Events

Affected versions

v0.*
v0.14.2
v0.14.3
v0.14.4
v0.14.5
v0.14.6
v0.14.7
v0.14.8
v0.14.9

Database specific

$schema
"https://cna.erlef.org/schemas/osv/affected-0.1.0.json"
modules
[
    "'Elixir.MDEx.FragmentParser'",
    "'Elixir.MDEx'"
]
program_files
[
    "lib/mdex/fragment_parser.ex",
    "lib/mdex.ex"
]
program_routines
[
    "'Elixir.MDEx.FragmentParser':autolink_size/2",
    "'Elixir.MDEx.FragmentParser':autolink_text/1",
    "'Elixir.MDEx.FragmentParser':complete/2",
    "'Elixir.MDEx.FragmentParser':complete_with_state/3",
    "'Elixir.MDEx':stream/2",
    "'Elixir.MDEx':to_html/2"
]
source
"https://cna.erlef.org/osv/EEF-CVE-2026-135775.json"