{"id":"CVE-2026-137162","aliases":["CVE-2026-137162","EEF-CVE-2026-137162"],"related":[],"kind":"vulnerability","state":"published","title":"Quadratic CPU consumption in mdex auto-close block quote prefix expansion","summary":"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.\n\nWhen 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.\n\nThis issue affects mdex: from 0.14.2 before 0.15.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.\n\nWhen 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.\n\nThis issue affects mdex: from 0.14.2 before 0.15.0.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nInefficient 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.\n\nWhen 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.\n\nThis issue affects mdex: from 0.14.2 before 0.15.0.\n\n## Proof of concept\n\n1. Build a Markdown input consisting of a single line of 400,000 `>` characters.\n2. Render it with `MDEx.to_html!(input, auto_close: true)`, or pass it as one chunk to `MDEx.stream/2`.\n3. Observe the call takes over ten seconds, compared with under 150 ms for `MDEx.to_html!(input)` without auto-close.\n\n## Impact\n\nAn attacker who can submit Markdown to an application that auto-closes or streams it can occupy a CPU core for seconds with a single request of a few hundred kilobytes, degrading rendering for other users.","format":"markdown","source":"eef"}],"published":"2026-11-30T18:43:23.753Z","modified":"2026-11-30T19:17:55.303Z","severity":{"scorer":"EEF","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N","score":2.1,"rating":"LOW"},"severities":[{"scorer":"EEF","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N","score":2.1,"rating":"LOW"},{"scorer":"Erlang Ecosystem Foundation","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"}],"cwes":["CWE-407"],"affected":[{"ranges":[{"type":"semver","introduced":"0.14.2","fixed":"0.15.0","status":"affected"}],"vendor":"leandrocp","product":"mdex","package":"mdex","cpe":"cpe:2.3:a:leandrocp:mdex:*:*:*:*:*:*:*:*","repo":"https://github.com/leandrocp/mdex","source":"cvelist"},{"ranges":[{"type":"git","introduced":"9a4b76802bfcd12ba34337bf3cf7d62621d0fe92","fixed":"2c29b28cd0473c24347aa00b95d16f9ce5f9d9af","status":"affected"}],"vendor":"leandrocp","product":"mdex","package":"leandrocp/mdex","cpe":"cpe:2.3:a:leandrocp:mdex:*:*:*:*:*:*:*:*","repo":"https://github.com/leandrocp/mdex","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0.14.2","status":"affected","fixed":"0.15.0"}],"ecosystem":"Hex","package":"mdex","purl":"pkg:hex/mdex","source":"eef"},{"ranges":[{"type":"git","introduced":"9a4b76802bfcd12ba34337bf3cf7d62621d0fe92","status":"affected","fixed":"2c29b28cd0473c24347aa00b95d16f9ce5f9d9af"}],"repo":"https://github.com/leandrocp/mdex","source":"eef"}],"references":[{"url":"https://cna.erlef.org/cves/CVE-2026-137162.html","tags":["related","third-party-advisory","web"],"sources":["cvelist","eef","nvd"]},{"url":"https://osv.dev/vulnerability/EEF-CVE-2026-137162","tags":["related"],"sources":["cvelist","nvd"]},{"url":"https://github.com/leandrocp/mdex/commit/9a4b76802bfcd12ba34337bf3cf7d62621d0fe92","tags":["related","web"],"sources":["cvelist","eef","nvd"]},{"url":"https://github.com/leandrocp/mdex/commit/2c29b28cd0473c24347aa00b95d16f9ce5f9d9af","tags":["fix","patch"],"sources":["cvelist","eef","nvd"]},{"url":"https://hex.pm/packages/mdex","tags":["package"],"sources":["eef"]}],"credits":["Peter Ullrich","Jonatan Männchen / EEF","Leandro Pereira"],"assigner":"EEF","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-137162","url":"https://www.cve.org/CVERecord?id=CVE-2026-137162","licence":"CVE Terms of Use","modified":"2026-11-30T18:43:23.753Z"},{"source":"eef","name":"Erlang Ecosystem Foundation","id":"EEF-CVE-2026-137162","url":"https://osv.dev/vulnerability/EEF-CVE-2026-137162","licence":"CC-BY-4.0","modified":"2026-11-30T18:45:05.657Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-137162","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-137162","licence":"Public domain","modified":"2026-11-30T19:17:55.303Z"}],"updatedAt":"2026-11-30T19:32:19.273Z","epss":{"score":0.00233,"percentile":0.15179,"date":"2026-12-01T12:00:22.000Z"}}