{"id":"EEF-CVE-2026-134916","summary":"Quadratic CPU consumption in MDEx Quill Delta conversion of nested block quotes","details":"## Summary\n\nInefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker who controls Markdown input to cause a denial of service through CPU exhaustion via deeply nested block quotes passed to `MDEx.to_delta/2`.\n\nWhen converting a document to a Quill Delta, `MDEx.DeltaConverter.default_convert_node/3` in `lib/mdex/delta_converter.ex` calls `apply_block_format/2` for every `MDEx.BlockQuote` and `MDEx.Alert` node, and that function rewrites every op produced by the node's descendants. Conversion therefore costs the nesting depth times the number of ops inside, and the parser places no limit on block quote depth. A document of a few hundred kilobytes keeps a scheduler busy for minutes, while parsing and HTML rendering of the same input finish in milliseconds. The `parse_time` budget bounds only the native parse, not the conversion.\n\nThis issue affects mdex: from 0.8.3 before 0.15.0.\n\n## Details\n\n**1. Input.** Comrak sets no limit on block quote depth, so a line of d `\u003e` characters followed by n lazy-continuation lines produces d nested `MDEx.BlockQuote` nodes holding about 2n ops, in only d+2n bytes.\n\n**2. Conversion.** `MDEx.DeltaConverter.default_convert_node/3` converts each block quote's children first and then calls `apply_block_format/2`, which maps over every descendant op to add the `blockquote` attribute to newline ops. `MDEx.Alert` does the same with its alert attributes. Each nesting level walks and rebuilds the whole op list again, so total work is O(d·n).\n\n**3. Effect.** Measured on 0.14.7, depth 2,000 with 20,000 lines (42 KB) takes 1.9 s, depth 5,000 with 50,000 lines (105 KB) takes 15 s, and depth 10,000 with 100,000 lines (210 KB) takes 172 s. Parsing and `MDEx.to_html/2` stay under about 100 ms for the same inputs. `budget: [parse_time: ...]` limits only the native parse: with `parse_time: 1000` the 105 KB input still spent 12 s in conversion.\n\n## Proof of concept\n\n1. Build a Markdown document of 4,000 `\u003e` characters, then ` a` and a newline, then 40,000 lines of `b` (about 84 KB).\n2. Convert it with `MDEx.to_delta!(markdown, budget: [parse_time: 1_000])`.\n3. Observe that the call takes several seconds (9.4 s on 0.14.9), while `MDEx.to_html!/1` on the same input finishes in about 16 ms. Doubling depth and line count roughly quadruples the conversion time.\n\n## Impact\n\nAn unauthenticated attacker who can submit Markdown to an application that converts it with `MDEx.to_delta/2` can occupy BEAM schedulers for minutes per small request, degrading or denying service to every other user of the node while the attack continues.","aliases":["CVE-2026-134916"],"modified":"2026-11-30T18:45:05.758234052Z","published":"2026-11-30T18:43:38.840Z","database_specific":{"cwe_ids":["CWE-407"],"$schema":"https://cna.erlef.org/schemas/osv/record-0.1.0.json","capec_ids":["CAPEC-230"],"cpe_ids":["cpe:2.3:a:leandrocp:mdex:*:*:*:*:*:*:*:*"]},"references":[{"type":"WEB","url":"https://cna.erlef.org/cves/CVE-2026-134916.html"},{"type":"WEB","url":"https://github.com/leandrocp/mdex/commit/9852db2456fdc9d856eb636603a7f608e22e3793"},{"type":"FIX","url":"https://github.com/leandrocp/mdex/commit/75e735a26859f93c36f10d17a3119f856fe69009"},{"type":"PACKAGE","url":"https://hex.pm/packages/mdex"}],"affected":[{"package":{"name":"mdex","ecosystem":"Hex","purl":"pkg:hex/mdex"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0.8.3"},{"fixed":"0.15.0"}]}],"versions":["0.10.0","0.11.0","0.11.1","0.11.2","0.11.3","0.11.4","0.11.5","0.11.6","0.11.7","0.12.0","0.12.1","0.12.2","0.12.3","0.12.4","0.12.5","0.13.0","0.13.1","0.13.2","0.13.3","0.13.4","0.13.5","0.14.0","0.14.1","0.14.2","0.14.3","0.14.4","0.14.5","0.14.6","0.14.7","0.14.8","0.14.9","0.8.3","0.8.4","0.8.5","0.8.6","0.9.0","0.9.1","0.9.2","0.9.3","0.9.4"],"ecosystem_specific":{"modules":["'Elixir.MDEx'","'Elixir.MDEx.DeltaConverter'"],"program_files":["lib/mdex.ex","lib/mdex/delta_converter.ex"],"program_routines":["'Elixir.MDEx':to_delta/2","'Elixir.MDEx':'to_delta!'/2","'Elixir.MDEx.DeltaConverter':convert/2","'Elixir.MDEx.DeltaConverter':default_convert_node/3","'Elixir.MDEx.DeltaConverter':apply_block_format/2"],"$schema":"https://cna.erlef.org/schemas/osv/affected-0.1.0.json"},"database_specific":{"modules":["'Elixir.MDEx'","'Elixir.MDEx.DeltaConverter'"],"source":"https://cna.erlef.org/osv/EEF-CVE-2026-134916.json","program_files":["lib/mdex.ex","lib/mdex/delta_converter.ex"],"program_routines":["'Elixir.MDEx':to_delta/2","'Elixir.MDEx':'to_delta!'/2","'Elixir.MDEx.DeltaConverter':convert/2","'Elixir.MDEx.DeltaConverter':default_convert_node/3","'Elixir.MDEx.DeltaConverter':apply_block_format/2"],"$schema":"https://cna.erlef.org/schemas/osv/affected-0.1.0.json"}},{"ranges":[{"type":"GIT","repo":"https://github.com/leandrocp/mdex","events":[{"introduced":"9852db2456fdc9d856eb636603a7f608e22e3793"},{"fixed":"75e735a26859f93c36f10d17a3119f856fe69009"}]}],"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","v0.14.1","v0.14.0","v0.13.5","v0.13.4","v0.13.3","v0.13.2","v0.13.1","v0.13.0","v0.12.5","v0.12.4","v0.12.3","v0.12.2","v0.12.1","v0.12.0","v0.11.7","v0.11.6","v0.11.5","v0.11.4","v0.11.3","v0.11.2","v0.11.1","v0.11.0","v0.10.0","v0.9.4","v0.9.3","v0.9.2","v0.9.1","v0.9.0","v0.8.6","v0.8.5","v0.8.4","v0.8.3"],"database_specific":{"program_files":["lib/mdex.ex","lib/mdex/delta_converter.ex"],"program_routines":["'Elixir.MDEx':to_delta/2","'Elixir.MDEx':'to_delta!'/2","'Elixir.MDEx.DeltaConverter':convert/2","'Elixir.MDEx.DeltaConverter':default_convert_node/3","'Elixir.MDEx.DeltaConverter':apply_block_format/2"],"$schema":"https://cna.erlef.org/schemas/osv/affected-0.1.0.json","modules":["'Elixir.MDEx'","'Elixir.MDEx.DeltaConverter'"],"source":"https://cna.erlef.org/osv/EEF-CVE-2026-134916.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/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"}]}