{"id":"EEF-CVE-2026-136129","summary":"Dangerous URL filter bypass via control characters in MDEx Quill Delta output (XSS)","details":"## Summary\n\nIncorrect Behavior Order: Validate Before Canonicalize vulnerability in leandrocp mdex allows an attacker who controls Markdown input to place `javascript:` and `data:` URLs into Quill Delta output via entity-encoded control characters.\n\n`MDEx.to_delta/2` blanks link, wikilink and image URLs that its dangerous-URL check flags, but `render_url/2` in `lib/mdex/delta_converter.ex` runs that prefix check on the entity-decoded URL without first normalizing it as a browser would. A destination such as `java&#9;script:alert(1)` reaches the check with a tab inside the scheme, passes, and is emitted unchanged. Browsers remove tab, carriage return and line feed and trim leading C0 control characters and spaces when parsing a URL, so the value runs as `javascript:`. Only applications that place the Delta `link` or `image` value into an `href` or `src` without their own URL check are exposed. Stock Quill re-sanitizes link protocols and is not affected.\n\nThis issue affects mdex: from 0.13.2 before 0.15.0.\n\n## Details\n\n**1. Entity decoding.** Comrak decodes HTML entities in link and image destinations while parsing, so `java&#9;script:alert(1)` becomes the URL `java`, a tab, `script:alert(1)`. The `&Tab;` and `&NewLine;` named entities, a leading `&#1;` or `&#32;`, `data&#9;:` and reference-style definitions behave the same way.\n\n**2. Unnormalized check.** `render_url/2` in `lib/mdex/delta_converter.ex` asks `MDExNative.Comrak.dangerous_url?/1` whether the URL is dangerous. That function is a plain prefix match on `javascript:`, `vbscript:`, `file:` and `data:`, so the decoded value does not match and is returned unchanged. A plain `javascript:` URL is still blanked.\n\n**3. Emission.** The Link, Image and WikiLink clauses of `default_convert_node/3` write the value into the Delta `link` or `image` attribute. The HTML renderer is not affected because it also percent-encodes URLs; the Delta path has no such step.\n\n**4. Browser normalization.** WHATWG URL parsing strips ASCII tab, line feed and carriage return anywhere and trims leading C0 controls and spaces, so a consumer that writes the value into `href` produces a working `javascript:` link.\n\n## Proof of concept\n\n1. Convert `[plain](javascript:alert(1)) [tab](java&#9;script:alert(1)) ![img](java&#10;script:alert(2)) [lead](&#1;javascript:alert(3))` with `MDEx.to_delta/2` and default options.\n2. Observe that the `plain` link is emitted as an empty string, while the other three are emitted as `java\\tscript:alert(1)`, `java\\nscript:alert(2)` and a value starting with byte 1 followed by `javascript:alert(3)`.\n3. Place the `tab` link value into an `\u003ca href\u003e` and click it: the browser strips the tab and runs `javascript:alert(1)`.\n\n## Impact\n\nAn attacker who can submit Markdown gets a stored `javascript:` or `data:` link into the Delta output, which runs script in the browser of a user who clicks it in an application that renders the Delta without its own URL check.\n\n## Configurations\n\nThe application must pass untrusted Markdown to `MDEx.to_delta/2` without the `unsafe` option and render the resulting Delta with a consumer (for example a custom Delta to HTML renderer or a non-Quill editor) that maps the `link` and `image` values to `href` and `src` without applying its own URL scheme check.","aliases":["CVE-2026-136129"],"modified":"2026-11-30T18:45:05.761354597Z","published":"2026-11-30T18:44:40.706Z","database_specific":{"$schema":"https://cna.erlef.org/schemas/osv/record-0.1.0.json","capec_ids":["CAPEC-267"],"cpe_ids":["cpe:2.3:a:leandrocp:mdex:*:*:*:*:*:*:*:*"],"cwe_ids":["CWE-180"]},"references":[{"type":"WEB","url":"https://cna.erlef.org/cves/CVE-2026-136129.html"},{"type":"WEB","url":"https://github.com/leandrocp/mdex/commit/2817147f5b87ce7186aa604c9ee72499485b8f2f"},{"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.13.2"},{"fixed":"0.15.0"}]}],"versions":["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"],"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.DeltaConverter':convert/2","'Elixir.MDEx.DeltaConverter':render_url/2","'Elixir.MDEx.DeltaConverter':default_convert_node/3"],"$schema":"https://cna.erlef.org/schemas/osv/affected-0.1.0.json"},"database_specific":{"program_routines":["'Elixir.MDEx':to_delta/2","'Elixir.MDEx.DeltaConverter':convert/2","'Elixir.MDEx.DeltaConverter':render_url/2","'Elixir.MDEx.DeltaConverter':default_convert_node/3"],"$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-136129.json","program_files":["lib/mdex.ex","lib/mdex/delta_converter.ex"]}},{"ranges":[{"type":"GIT","repo":"https://github.com/leandrocp/mdex","events":[{"introduced":"2817147f5b87ce7186aa604c9ee72499485b8f2f"},{"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"],"database_specific":{"modules":["'Elixir.MDEx'","'Elixir.MDEx.DeltaConverter'"],"source":"https://cna.erlef.org/osv/EEF-CVE-2026-136129.json","program_files":["lib/mdex.ex","lib/mdex/delta_converter.ex"],"program_routines":["'Elixir.MDEx':to_delta/2","'Elixir.MDEx.DeltaConverter':convert/2","'Elixir.MDEx.DeltaConverter':render_url/2","'Elixir.MDEx.DeltaConverter':default_convert_node/3"],"$schema":"https://cna.erlef.org/schemas/osv/affected-0.1.0.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/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"}]}