{"schema_version":"1.9.2","id":"EEF-CVE-2026-137162","published":"2026-11-30T18:43:23.753Z","modified":"2026-11-30T18:45:05.657160956Z","aliases":["CVE-2026-137162"],"summary":"Quadratic CPU consumption in mdex auto-close block quote prefix expansion","details":"## 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.","affected":[{"package":{"name":"mdex","ecosystem":"Hex","purl":"pkg:hex/mdex"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0.14.2"},{"fixed":"0.15.0"}]}],"versions":["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'"],"program_files":["lib/mdex/fragment_parser.ex"],"program_routines":["'Elixir.MDEx.FragmentParser':expand_quote_prefix/2","'Elixir.MDEx.FragmentParser':complete/2"]},"database_specific":{"$schema":"https://cna.erlef.org/schemas/osv/affected-0.1.0.json","modules":["'Elixir.MDEx.FragmentParser'"],"program_files":["lib/mdex/fragment_parser.ex"],"program_routines":["'Elixir.MDEx.FragmentParser':expand_quote_prefix/2","'Elixir.MDEx.FragmentParser':complete/2"],"source":"https://cna.erlef.org/osv/EEF-CVE-2026-137162.json"}},{"ranges":[{"type":"GIT","repo":"https://github.com/leandrocp/mdex","events":[{"introduced":"9a4b76802bfcd12ba34337bf3cf7d62621d0fe92"},{"fixed":"2c29b28cd0473c24347aa00b95d16f9ce5f9d9af"}]}],"versions":["v0.14.9","v0.14.8","v0.14.7","v0.14.6","v0.14.5","v0.14.4","v0.14.3","v0.14.2"],"database_specific":{"$schema":"https://cna.erlef.org/schemas/osv/affected-0.1.0.json","modules":["'Elixir.MDEx.FragmentParser'"],"program_files":["lib/mdex/fragment_parser.ex"],"program_routines":["'Elixir.MDEx.FragmentParser':expand_quote_prefix/2","'Elixir.MDEx.FragmentParser':complete/2"],"source":"https://cna.erlef.org/osv/EEF-CVE-2026-137162.json"}}],"references":[{"type":"WEB","url":"https://cna.erlef.org/cves/CVE-2026-137162.html"},{"type":"WEB","url":"https://github.com/leandrocp/mdex/commit/9a4b76802bfcd12ba34337bf3cf7d62621d0fe92"},{"type":"FIX","url":"https://github.com/leandrocp/mdex/commit/2c29b28cd0473c24347aa00b95d16f9ce5f9d9af"},{"type":"PACKAGE","url":"https://hex.pm/packages/mdex"}],"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"]},"severity":[{"type":"CVSS_V4","score":"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","source":"CNA"}],"credits":[{"name":"Peter Ullrich","type":"FINDER"},{"name":"Peter Ullrich","type":"REPORTER"},{"name":"Jonatan Männchen / EEF","type":"ANALYST"},{"name":"Leandro Pereira","type":"REMEDIATION_DEVELOPER"}]}