Inefficient 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.
When 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.
This issue affects mdex: from 0.8.3 before 0.15.0.
1. Input. Comrak sets no limit on block quote depth, so a line of d > characters followed by n lazy-continuation lines produces d nested MDEx.BlockQuote nodes holding about 2n ops, in only d+2n bytes.
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).
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.
> characters, then a and a newline, then 40,000 lines of b (about 84 KB).MDEx.to_delta!(markdown, budget: [parse_time: 1_000]).MDEx.to_html!/1 on the same input finishes in about 16 ms. Doubling depth and line count roughly quadruples the conversion time.An 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.
{
"$schema": "https://cna.erlef.org/schemas/osv/record-0.1.0.json",
"capec_ids": [
"CAPEC-230"
],
"cpe_ids": [
"cpe:2.3:a:leandrocp:mdex:*:*:*:*:*:*:*:*"
],
"cwe_ids": [
"CWE-407"
]
}{
"$schema": "https://cna.erlef.org/schemas/osv/affected-0.1.0.json",
"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"
]
}
"https://cna.erlef.org/schemas/osv/affected-0.1.0.json"
[
"'Elixir.MDEx'",
"'Elixir.MDEx.DeltaConverter'"
]
[
"lib/mdex.ex",
"lib/mdex/delta_converter.ex"
]
[
"'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"
]
"https://cna.erlef.org/osv/EEF-CVE-2026-134916.json"
"https://cna.erlef.org/schemas/osv/affected-0.1.0.json"
[
"'Elixir.MDEx'",
"'Elixir.MDEx.DeltaConverter'"
]
[
"lib/mdex.ex",
"lib/mdex/delta_converter.ex"
]
[
"'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"
]
"https://cna.erlef.org/osv/EEF-CVE-2026-134916.json"