Where
-Infinity
0
Severity
6.9
AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Summary

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.todelta/2.

When converting a document to a Quill Delta, MDEx.DeltaConverter.defaultconvertnode/3 in lib/mdex/deltaconverter.ex calls applyblockformat/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 parsetime budget bounds only the native parse, not the conversion.

This issue affects mdex: from 0.8.3 before 0.15.0.

Details

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.defaultconvertnode/3 converts each block quote's children first and then calls applyblockformat/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.tohtml/2 stay under about 100 ms for the same inputs. budget: [parsetime: ...] limits only the native parse: with parsetime: 1000 the 105 KB input still spent 12 s in conversion.

Proof of concept

1. Build a Markdown document of 4,000 > characters, then a and a newline, then 40,000 lines of b (about 84 KB). 2. Convert it with MDEx.todelta!(markdown, budget: [parsetime: 1000]). 3. Observe that the call takes several seconds (9.4 s on 0.14.9), while MDEx.tohtml!/1 on the same input finishes in about 16 ms. Doubling depth and line count roughly quadruples the conversion time.

Impact

An unauthenticated attacker who can submit Markdown to an application that converts it with MDEx.todelta/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.

1 / 2
Source: OSV
First published (updated )
Severity
6.9
AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Summary

Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker who controls Markdown passed to MDEx.stream/2 to exhaust CPU via unmatched HTML closing tags.

MDEx.stream/2 tracks open HTML tags with MDEx.FragmentParser.continuehtmlcontext/2 in lib/mdex/fragmentparser.ex. Every non-void opening tag is pushed onto an unbounded list, and closehtmltag/2 scans the whole list for each closing tag. A closer with no matching opener leaves the list unchanged, so the next closer scans it again. An HTML block of N openers followed by N unmatched closers therefore costs O(N²), and about 270 KB of input keeps a scheduler busy for tens of seconds. The tracking runs on every HTML block and inline HTML literal regardless of the autoclose option and the render unsafe setting. MDEx.tohtml/1 and the other non-streaming entry points are not affected.

This issue affects mdex: from 0.14.0 before 0.15.0.

Details

1. Reachability. MDEx.stream/2 renders each chunk through emitstreamsource, streamsourceblocks and streamnodegroups in lib/mdex.ex. streamnodegroups calls MDEx.FragmentParser.continuehtmlcontext/2 on every parsed node, so every HtmlBlock and HtmlInline literal is scanned, whatever the autoclose and render unsafe settings are.

2. Unbounded stack. scanhtml pushes every non-void, non-self-closing opening tag onto the context list with no size limit.

3. Quadratic scan. For each closing tag, closehtmltag/2 runs Enum.splitwhile/2 over the whole list. When no matching opener exists, it returns the list unchanged, so every following unmatched closer walks the full list again. N openers followed by N unmatched closers cost O(N²).

Proof of concept

1. Build a Markdown string of <div> repeated 30,000 times followed by </b> repeated 30,000 times (270,000 bytes). 2. Render it as one chunk with MDEx.stream(autoclose: false) and run the stream. 3. Observe about 30 seconds of CPU on mdex 0.14.9, against a few milliseconds for MDEx.tohtml!/1 on the same input. Doubling the input roughly quadruples the time.

Impact

An attacker who can submit Markdown that an application renders with MDEx.stream/2 can tie up a BEAM scheduler for tens of seconds per request, and a few concurrent requests stall the node.

1 / 2
Source: OSV
First published (updated )
Severity
6.9
AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Summary

Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker to cause a denial of service through excessive CPU consumption via crafted nested block quotes passed to MDEx.toslack/2.

renderquote/2 in lib/mdex/slackconverter.ex renders the whole child subtree of a block quote to a binary, splits it on newlines and rejoins it with a > prefix, and repeats this at every nesting level. Block quote depth is not limited, so an input with d leading > characters followed by m lazy-continuation lines ending in a backslash hard break costs time proportional to d²·m. A 16 KB message takes about 16 seconds of CPU and produces 32 MB of output, and the cost grows about eightfold each time the input doubles. Any application that converts untrusted Markdown with MDEx.toslack/2 or MDEx.toslack!/2 is affected.

This issue affects mdex: from 0.13.1 before 0.15.0.

Proof of concept

1. Build a Markdown string of 4000 > characters followed by a\, a newline, 4000 lines of b\, and a final c (about 16 KB). 2. Pass it to MDEx.toslack!/1. 3. Observe about 16 seconds of CPU and 32 MB of output, while MDEx.tohtml!/1 on the same input returns in about 1 ms.

Impact

An attacker who can submit a few kilobytes of Markdown to an application that forwards it to Slack through MDEx.toslack/2 can occupy a scheduler for seconds to minutes per message and force tens of megabytes of allocation, degrading or denying service to other users.

1 / 2
Source: OSV
First published (updated )
Severity
6.9
AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Summary

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.todelta/2.

When converting a document to a Quill Delta, MDEx.DeltaConverter.defaultconvertnode/3 in lib/mdex/deltaconverter.ex calls applyblockformat/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 parsetime budget bounds only the native parse, not the conversion.

This issue affects mdex: from 0.8.3 before 0.15.0.

Details

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.defaultconvertnode/3 converts each block quote's children first and then calls applyblockformat/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.tohtml/2 stay under about 100 ms for the same inputs. budget: [parsetime: ...] limits only the native parse: with parsetime: 1000 the 105 KB input still spent 12 s in conversion.

Proof of concept

1. Build a Markdown document of 4,000 > characters, then a and a newline, then 40,000 lines of b (about 84 KB). 2. Convert it with MDEx.todelta!(markdown, budget: [parsetime: 1000]). 3. Observe that the call takes several seconds (9.4 s on 0.14.9), while MDEx.tohtml!/1 on the same input finishes in about 16 ms. Doubling depth and line count roughly quadruples the conversion time.

Impact

An unauthenticated attacker who can submit Markdown to an application that converts it with MDEx.todelta/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.

1 / 2
Source: OSV
First published (updated )
Severity
6.9
AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Summary

Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker who controls Markdown passed to MDEx.stream/2 to exhaust CPU via unmatched HTML closing tags.

MDEx.stream/2 tracks open HTML tags with MDEx.FragmentParser.continuehtmlcontext/2 in lib/mdex/fragmentparser.ex. Every non-void opening tag is pushed onto an unbounded list, and closehtmltag/2 scans the whole list for each closing tag. A closer with no matching opener leaves the list unchanged, so the next closer scans it again. An HTML block of N openers followed by N unmatched closers therefore costs O(N²), and about 270 KB of input keeps a scheduler busy for tens of seconds. The tracking runs on every HTML block and inline HTML literal regardless of the autoclose option and the render unsafe setting. MDEx.tohtml/1 and the other non-streaming entry points are not affected.

This issue affects mdex: from 0.14.0 before 0.15.0.

Details

1. Reachability. MDEx.stream/2 renders each chunk through emitstreamsource, streamsourceblocks and streamnodegroups in lib/mdex.ex. streamnodegroups calls MDEx.FragmentParser.continuehtmlcontext/2 on every parsed node, so every HtmlBlock and HtmlInline literal is scanned, whatever the autoclose and render unsafe settings are.

2. Unbounded stack. scanhtml pushes every non-void, non-self-closing opening tag onto the context list with no size limit.

3. Quadratic scan. For each closing tag, closehtmltag/2 runs Enum.splitwhile/2 over the whole list. When no matching opener exists, it returns the list unchanged, so every following unmatched closer walks the full list again. N openers followed by N unmatched closers cost O(N²).

Proof of concept

1. Build a Markdown string of <div> repeated 30,000 times followed by </b> repeated 30,000 times (270,000 bytes). 2. Render it as one chunk with MDEx.stream(autoclose: false) and run the stream. 3. Observe about 30 seconds of CPU on mdex 0.14.9, against a few milliseconds for MDEx.tohtml!/1 on the same input. Doubling the input roughly quadruples the time.

Impact

An attacker who can submit Markdown that an application renders with MDEx.stream/2 can tie up a BEAM scheduler for tens of seconds per request, and a few concurrent requests stall the node.

1 / 2
Source: OSV
First published (updated )
Severity
6.9
AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Summary

Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker to cause a denial of service through excessive CPU consumption via crafted nested block quotes passed to MDEx.toslack/2.

renderquote/2 in lib/mdex/slackconverter.ex renders the whole child subtree of a block quote to a binary, splits it on newlines and rejoins it with a > prefix, and repeats this at every nesting level. Block quote depth is not limited, so an input with d leading > characters followed by m lazy-continuation lines ending in a backslash hard break costs time proportional to d²·m. A 16 KB message takes about 16 seconds of CPU and produces 32 MB of output, and the cost grows about eightfold each time the input doubles. Any application that converts untrusted Markdown with MDEx.toslack/2 or MDEx.toslack!/2 is affected.

This issue affects mdex: from 0.13.1 before 0.15.0.

Proof of concept

1. Build a Markdown string of 4000 > characters followed by a\, a newline, 4000 lines of b\, and a final c (about 16 KB). 2. Pass it to MDEx.toslack!/1. 3. Observe about 16 seconds of CPU and 32 MB of output, while MDEx.tohtml!/1 on the same input returns in about 1 ms.

Impact

An attacker who can submit a few kilobytes of Markdown to an application that forwards it to Slack through MDEx.toslack/2 can occupy a scheduler for seconds to minutes per message and force tens of megabytes of allocation, degrading or denying service to other users.

1 / 2
Source: OSV
First published (updated )
Severity
5.9
AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Summary

Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker who controls rendered Markdown to cause a denial of service via a bare URL followed by many closing parentheses.

When auto-close is active, MDEx.FragmentParser.autolinksize/2 in lib/mdex/fragmentparser.ex trims trailing ) from a bare URL one byte at a time and recounts every ( and ) in the remaining URL at each step, so a URL followed by N parentheses costs O(N²) work. Around 20 KB of input pins a scheduler for tens of seconds, and MDEx.stream/2 repeats the completion over the whole accumulated source for every chunk. No extension needs to be enabled. Rendering with auto-close disabled is not affected.

This issue affects mdex: from 0.14.2 before 0.15.0.

Details

1. Reaching the trimmer. With auto-close active, MDEx.FragmentParser.complete/2 runs completeinline/3, which calls unmatchedsuffix/1. That masks bare URLs through maskurls/1 and maskurlspans/4, and each URL span is measured with autolinktext/1. No extension needs to be enabled.

2. Quadratic trim. autolinksize/2 walks back from the end of the URL candidate. For every trailing ) it takes the remaining prefix, counts all ( and all ) in it with countchar/2, and if closers outnumber openers it drops one byte and recurses. A URL followed by N ) therefore performs N full scans of a string of length up to N, which is O(N²).

3. Amplification. MDEx.stream/2 re-runs completion over the whole accumulated source for every chunk, so a payload delivered over many chunks multiplies the cost. None of the entry points limits input size.

Proof of concept

1. Build the input "http://x" followed by 15,000 ) characters (about 15 KB). 2. Render it with MDEx.tohtml!(markdown): it completes in a few milliseconds. 3. Render the same input with MDEx.tohtml!(markdown, autoclose: true), or pass it as a single chunk to MDEx.stream/2: rendering takes tens of seconds and holds a scheduler for the whole time. 4. Doubling the number of parentheses roughly quadruples the time.

Impact

An attacker who can supply Markdown, or steer LLM output, that an application renders with auto-close can pin BEAM schedulers with a few kilobytes of input per request, delaying or denying service to every other user of the node.

Workarounds

Render untrusted Markdown with auto-close disabled: pass autoclose: false to MDEx.stream/2, and do not pass autoclose: true to MDEx.tohtml/2 or the other renderers.

Configurations

The vulnerable code runs only when auto-close is active: in MDEx.stream/2, where autoclose defaults to true; in MDEx.tohtml/2 and the other renderers when called with autoclose: true; and in MDEx.Document streaming buffers with autoclose set. Rendering with the default options of MDEx.tohtml/2 does not reach it.

1 / 2
Source: OSV
First published (updated )
Severity
5.9
AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Summary

Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker who controls rendered Markdown to cause a denial of service via a bare URL followed by many closing parentheses.

When auto-close is active, MDEx.FragmentParser.autolinksize/2 in lib/mdex/fragmentparser.ex trims trailing ) from a bare URL one byte at a time and recounts every ( and ) in the remaining URL at each step, so a URL followed by N parentheses costs O(N²) work. Around 20 KB of input pins a scheduler for tens of seconds, and MDEx.stream/2 repeats the completion over the whole accumulated source for every chunk. No extension needs to be enabled. Rendering with auto-close disabled is not affected.

This issue affects mdex: from 0.14.2 before 0.15.0.

Details

1. Reaching the trimmer. With auto-close active, MDEx.FragmentParser.complete/2 runs completeinline/3, which calls unmatchedsuffix/1. That masks bare URLs through maskurls/1 and maskurlspans/4, and each URL span is measured with autolinktext/1. No extension needs to be enabled.

2. Quadratic trim. autolinksize/2 walks back from the end of the URL candidate. For every trailing ) it takes the remaining prefix, counts all ( and all ) in it with countchar/2, and if closers outnumber openers it drops one byte and recurses. A URL followed by N ) therefore performs N full scans of a string of length up to N, which is O(N²).

3. Amplification. MDEx.stream/2 re-runs completion over the whole accumulated source for every chunk, so a payload delivered over many chunks multiplies the cost. None of the entry points limits input size.

Proof of concept

1. Build the input "http://x" followed by 15,000 ) characters (about 15 KB). 2. Render it with MDEx.tohtml!(markdown): it completes in a few milliseconds. 3. Render the same input with MDEx.tohtml!(markdown, autoclose: true), or pass it as a single chunk to MDEx.stream/2: rendering takes tens of seconds and holds a scheduler for the whole time. 4. Doubling the number of parentheses roughly quadruples the time.

Impact

An attacker who can supply Markdown, or steer LLM output, that an application renders with auto-close can pin BEAM schedulers with a few kilobytes of input per request, delaying or denying service to every other user of the node.

Workarounds

Render untrusted Markdown with auto-close disabled: pass autoclose: false to MDEx.stream/2, and do not pass autoclose: true to MDEx.tohtml/2 or the other renderers.

Configurations

The vulnerable code runs only when auto-close is active: in MDEx.stream/2, where autoclose defaults to true; in MDEx.tohtml/2 and the other renderers when called with autoclose: true; and in MDEx.Document streaming buffers with autoclose set. Rendering with the default options of MDEx.tohtml/2 does not reach it.

1 / 2
Source: OSV
First published (updated )
Severity
5.1
XSS
AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N

Summary

Improper Neutralization of Input During Web Page Generation (XSS) vulnerability in leandrocp mdex allows cross-site scripting via unsanitized URL schemes in Quill Delta output.

MDEx.todelta/2 converts Markdown into a Quill Delta. MDEx.DeltaConverter.defaultconvertnode/3 in lib/mdex/deltaconverter.ex copies the URL of a link, wikilink, or image node directly from the parsed Markdown into the Delta "link" or "image" attribute without applying a scheme allowlist or any normalization.

An attacker who controls the Markdown text can supply a javascript: URL (for example click)) that survives verbatim into the Delta attribute. When the Delta is rendered to HTML by a downstream renderer (such as quill-delta-to-html or the Quill client), the attribute becomes an <a href> or <img src>, and the javascript: scheme executes in the browser of anyone who views the rendered content. The link and wikilink cases are the strongest vectors because javascript: in an href executes on click; the image case is lower impact because javascript: in <img src> generally does not execute in modern browsers.

This issue affects mdex: from 0.8.3 before 0.13.2.

Workarounds

Sanitize the Quill Delta produced by MDEx.todelta/2 before rendering it: drop or blank any "link" or "image" value whose URL scheme is not in a safe allowlist (http, https, mailto, tel).

Configurations

The application must pass untrusted Markdown to MDEx.todelta/2 and then render the resulting Quill Delta to HTML with a renderer that maps the "link" and "image" attributes to href and src without applying its own URL scheme sanitization (for example quill-delta-to-html or the Quill client).

1 / 2
Source: OSV
First published (updated )
Severity
5.1
XSS
AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N

Summary

Improper Neutralization of Input During Web Page Generation (XSS) vulnerability in leandrocp mdex allows cross-site scripting via unsanitized URL schemes in Quill Delta output.

MDEx.todelta/2 converts Markdown into a Quill Delta. MDEx.DeltaConverter.defaultconvertnode/3 in lib/mdex/deltaconverter.ex copies the URL of a link, wikilink, or image node directly from the parsed Markdown into the Delta "link" or "image" attribute without applying a scheme allowlist or any normalization.

An attacker who controls the Markdown text can supply a javascript: URL (for example click)) that survives verbatim into the Delta attribute. When the Delta is rendered to HTML by a downstream renderer (such as quill-delta-to-html or the Quill client), the attribute becomes an <a href> or <img src>, and the javascript: scheme executes in the browser of anyone who views the rendered content. The link and wikilink cases are the strongest vectors because javascript: in an href executes on click; the image case is lower impact because javascript: in <img src> generally does not execute in modern browsers.

This issue affects mdex: from 0.8.3 before 0.13.2.

Workarounds

Sanitize the Quill Delta produced by MDEx.todelta/2 before rendering it: drop or blank any "link" or "image" value whose URL scheme is not in a safe allowlist (http, https, mailto, tel).

Configurations

The application must pass untrusted Markdown to MDEx.todelta/2 and then render the resulting Quill Delta to HTML with a renderer that maps the "link" and "image" attributes to href and src without applying its own URL scheme sanitization (for example quill-delta-to-html or the Quill client).

1 / 2
Source: OSV
First published (updated )
Severity
5.1
AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Summary

Improper Neutralization of Escape, Meta, or Control Sequences vulnerability in leandrocp mdex allows Content Spoofing via code block content passed to MDEx.toslack/2. An attacker who controls Markdown that an application converts to Slack mrkdwn can inject <!channel>, <!here> and <@user> mentions and links whose visible label differs from their target, with default options.

In lib/mdex/slackconverter.ex, the MDEx.CodeBlock clause of rendernode/2 wraps the block's literal in a fixed three-backtick fence and emits it without the escaping applied to every other text node. A block opened with four backticks or tildes whose body contains a line of three backticks therefore closes the Slack code block early, and the rest of the body is parsed as live mrkdwn. Links injected this way also skip the dangerous URL filter in renderurl/2.

This issue affects mdex: from 0.13.1 before 0.15.0.

Details

1. Input handling. MDEx.toslack/2 parses the Markdown and passes the document to MDEx.SlackConverter.convert/2, which renders each node. Text, inline code and link labels go through escapetext/1, which encodes &, < and >.

2. Unsafe processing. The MDEx.CodeBlock clause of rendernode/2 emits the block literal unchanged between a fixed opening and closing three-backtick fence. CommonMark lets a block opened with four backticks or ~~~ contain a line of three backticks, so that line reaches the output intact.

3. Effect in Slack. Slack ends a code block at the next three backticks, so the inner line closes the fence and the remaining body is parsed as mrkdwn. Mention tokens such as <!channel> and links such as <https://evil.example|https://trusted.example> become live, while the same text outside a code block is escaped. Injected links never pass through renderurl/2, so its dangerous URL check does not apply.

Proof of concept

1. Supply Markdown that opens a code block with four backticks, has a line of three backticks as its first body line, then the line <!channel> <https://evil.example|https://trusted.example>, and closes with four backticks. 2. Convert it with MDEx.toslack/2 using default options. 3. Observe that the output's code block ends at the inner three-backtick line and the following line keeps <!channel> and the label-spoofed link unescaped outside any code block, while a plain-text <!channel> elsewhere in the same input is escaped to &lt;!channel&gt;.

Impact

An attacker who can submit Markdown that an application forwards to Slack can trigger channel-wide or per-user notifications and post links whose visible label shows a trusted URL while pointing elsewhere, in messages that appear to come from the application.

1 / 2
Source: OSV
First published (updated )
Severity
5.1
AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:L/SA:N

Summary

Improper Neutralization of Escape, Meta, or Control Sequences vulnerability in leandrocp mdex allows Content Spoofing via code block content passed to MDEx.toslack/2. An attacker who controls Markdown that an application converts to Slack mrkdwn can inject <!channel>, <!here> and <@user> mentions and links whose visible label differs from their target, with default options.

In lib/mdex/slackconverter.ex, the MDEx.CodeBlock clause of rendernode/2 wraps the block's literal in a fixed three-backtick fence and emits it without the escaping applied to every other text node. A block opened with four backticks or tildes whose body contains a line of three backticks therefore closes the Slack code block early, and the rest of the body is parsed as live mrkdwn. Links injected this way also skip the dangerous URL filter in renderurl/2.

This issue affects mdex: from 0.13.1 before 0.15.0.

Details

1. Input handling. MDEx.toslack/2 parses the Markdown and passes the document to MDEx.SlackConverter.convert/2, which renders each node. Text, inline code and link labels go through escapetext/1, which encodes &, < and >.

2. Unsafe processing. The MDEx.CodeBlock clause of rendernode/2 emits the block literal unchanged between a fixed opening and closing three-backtick fence. CommonMark lets a block opened with four backticks or ~~~ contain a line of three backticks, so that line reaches the output intact.

3. Effect in Slack. Slack ends a code block at the next three backticks, so the inner line closes the fence and the remaining body is parsed as mrkdwn. Mention tokens such as <!channel> and links such as <https://evil.example|https://trusted.example> become live, while the same text outside a code block is escaped. Injected links never pass through renderurl/2, so its dangerous URL check does not apply.

Proof of concept

1. Supply Markdown that opens a code block with four backticks, has a line of three backticks as its first body line, then the line <!channel> <https://evil.example|https://trusted.example>, and closes with four backticks. 2. Convert it with MDEx.toslack/2 using default options. 3. Observe that the output's code block ends at the inner three-backtick line and the following line keeps <!channel> and the label-spoofed link unescaped outside any code block, while a plain-text <!channel> elsewhere in the same input is escaped to &lt;!channel&gt;.

Impact

An attacker who can submit Markdown that an application forwards to Slack can trigger channel-wide or per-user notifications and post links whose visible label shows a trusted URL while pointing elsewhere, in messages that appear to come from the application.

1 / 2
Source: OSV
First published (updated )
Severity
2.1
AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Summary

Incorrect 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.

MDEx.todelta/2 blanks link, wikilink and image URLs that its dangerous-URL check flags, but renderurl/2 in lib/mdex/deltaconverter.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.

This issue affects mdex: from 0.13.2 before 0.15.0.

Details

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.

2. Unnormalized check. renderurl/2 in lib/mdex/deltaconverter.ex asks MDExNative.Comrak.dangerousurl?/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.

3. Emission. The Link, Image and WikiLink clauses of defaultconvertnode/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.

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.

Proof of concept

1. Convert plain) tab) !img) lead) with MDEx.todelta/2 and default options. 2. 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). 3. Place the tab link value into an <a href> and click it: the browser strips the tab and runs javascript:alert(1).

Impact

An 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.

Configurations

The application must pass untrusted Markdown to MDEx.todelta/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.

1 / 2
Source: OSV
First published (updated )
Severity
2.1
AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Summary

Improper Neutralization of Escape, Meta, or Control Sequences vulnerability in leandrocp mdex allows Slack mention and broadcast injection via link, image, and wikilink destinations. MDEx.toslack/2 renders these nodes as Slack <url|label> links and writes the destination between the angle brackets without rejecting Slack control prefixes. A destination such as !channel, !here, @U012AB3CD or !subteam^ID therefore comes out as <!channel|label> or <@U012AB3CD|label>, which Slack treats as a broadcast or a user or group mention. The same sequences in plain text are escaped.

Anyone whose Markdown an application forwards to Slack through MDEx.toslack/2 (user content, tickets, LLM output) can make the posting bot notify a whole channel or ping arbitrary users and groups. In lib/mdex/slackconverter.ex, renderurl/2 only drops URLs that the dangerous-URL check flags, and escapelinkpart/1 only escapes &, <, > and |.

This issue affects mdex: from 0.13.1 before 0.15.0.

Proof of concept

1. Call MDEx.toslack!("plain <!channel> read this !logo ping grp"). 2. Observe the output plain &lt;!channel&gt; <!channel|read this> <!here|logo> <@U012AB3CD|ping> <!subteam^SAZ94GDB8|grp>: the plain-text sequence is escaped, the link and image destinations are emitted as live Slack control sequences. 3. With extension: [wikilinkstitleafterpipe: true], [[!channel|x]] renders as <!channel|x>.

Impact

An attacker who controls Markdown that an application posts to Slack via MDEx.toslack/2 can trigger @channel/@here broadcasts and ping arbitrary users or user groups from the application's bot.

1 / 2
Source: OSV
First published (updated )
Severity
2.1
AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Summary

Inefficient Algorithmic Complexity vulnerability in MDEx.FragmentParser in leandrocp mdex allows an attacker who controls streamed or auto-closed Markdown to cause a denial of service through CPU exhaustion. Any application that renders untrusted Markdown with MDEx.stream/2 or the autoclose option is affected, for example live previews or streamed LLM output.

While auto-closing the last paragraph, closebracket/5 in lib/mdex/fragmentparser.ex runs an unbounded forward scan of the link tail for every ](. When that scan finds no valid link, scanning resumes just after the ], so the next ]( rescans the same tail. Each closed link also re-filters every pending image opener. Repeated [](x (, [](x(, or ![ openers in one paragraph therefore cost quadratic time, and about 100 KB of input occupies a scheduler for over ten seconds.

This issue affects mdex: from 0.14.2 before 0.15.0.

Details

1. Entry. MDEx.stream/2 (auto-close on by default) and documents with autoclose call MDEx.FragmentParser.complete/2, which reaches incompleteparagraphlink/5 and openlink/5 for the last paragraph. Scanning stops at a blank line, so an attacker who never sends one keeps the whole input in scope.

2. Rescan. For every ](, closebracket/5 calls linktail/2, which scans forward without bound through baredestination/3, linktitleend/4 and linkclose/2. When the tail is :invalid, continueafterlink/2 resumes just after the ], so the next ]( rescans the same tail. An unterminated title ( or nested parentheses ( makes every scan run to the end of the paragraph.

3. Opener filtering. Each closed link runs Enum.filter/2 over every pending opener to keep only images. With ![ repeated N times followed by N closed links, that is N filters over N openers.

All three shapes cost O(N^2). The reporter measured 120 KB of [](x ( at 12.0 s in a one-chunk MDEx.stream/2, against about 10 ms for MDEx.tohtml!/1 without auto-close.

Proof of concept

1. Build a single paragraph of 20,000 repetitions of z (about 120 KB, no blank line). 2. Pass it as one chunk to MDEx.stream/2 and consume the stream. 3. Observe the call take over ten seconds, while MDEx.tohtml!/1 on the same input returns in about 10 ms. Doubling the input roughly quadruples the time.

Impact

An attacker who can submit Markdown to a streaming or auto-closing renderer can occupy a CPU scheduler for seconds per request with about 100 KB of input, slowing or denying rendering for other users.

Configurations

The application must render untrusted Markdown with auto-closing enabled: through MDEx.stream/2, where it is on unless autoclose: false is passed, or with the autoclose option set on a document. Rendering with the default options of MDEx.tohtml/2 and MDEx.parsedocument/2 does not run the affected scanner.

1 / 2
Source: OSV
First published (updated )
Severity
2.1
AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Summary

Inefficient Regular Expression Complexity vulnerability in leandrocp mdex allows an attacker to exhaust CPU via crafted unterminated link or image labels.

When an application completes partial Markdown with the non-default autoclose: [links: :text] or autoclose: [images: :text] policy, MDEx.FragmentParser.textlabel/1 in lib/mdex/fragmentparser.ex escapes the pending label with two regular expressions, \A[^\n]+|[^\n]+\z and ~{3,}\z, that are anchored at one end only. The engine retries the unanchored alternative from every offset, so the cost grows with the square of a label line or trailing tilde run. An attacker who supplies the Markdown, such as user content or streamed LLM output, can make a single render of about 60 KB take tens of seconds of CPU. The default autoclose: true policy is not affected.

This issue affects mdex: from 0.14.3 before 0.15.0.

Details

1. Reaching the label. MDEx.FragmentParser.complete/2 (also reached through MDEx.tohtml/2 and the streaming document when autoclose is set) closes an unterminated link or image. Under the :text policy, pendinglink/3 and completelabel/3 hand the attacker's label to textlabel/1. The destination branch of completelink/4 lets the label span several lines, for example [a, a long middle line, then b](htt.

2. Quadratic matching. textlabel/1 runs Regex.replace with \A[^\n]+|[^\n]+\z. On a middle line the first alternative cannot match and the second consumes the whole line before failing at \z, and the engine repeats this from every later offset, so a line of N bytes costs about N squared steps. The trailing-tilde pass ~{3,}\z behaves the same way on a long run of tildes.

3. Effect. One render occupies a scheduler for seconds: a 60 KB label took about 23 s on mdex 0.14.9, against about 11 ms with the default policy, and quadrupling the input raised the time about 18 times.

Proof of concept

1. Use an application that renders untrusted Markdown with autoclose: [links: :text]. 2. Submit a fragment made of [a, a newline, 60 000 x characters, a newline, and b](htt, leaving the link unterminated. 3. Render it with MDEx.tohtml!/2 and those options. The call takes tens of seconds of CPU, while the same input with autoclose: true renders in milliseconds. 4. Alternatively, submit [~~~ followed by 40 000 ~ characters and x](htt to drive the trailing-tilde regex.

Impact

An attacker who controls Markdown rendered with the :text auto-close policy can make each render consume seconds of CPU, slowing or stalling the application under repeated requests.

Configurations

The application must render or complete attacker-influenced Markdown with the :text completion policy for links or images, autoclose: [links: :text] or autoclose: [images: :text]. The default autoclose: true policy and rendering without autoclose are not affected.

1 / 2
Source: OSV
First published (updated )
Severity
2.1
AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

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.

When Markdown is rendered with autoclose: 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 expandquoteprefix/2 in lib/mdex/fragmentparser.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.

This issue affects mdex: from 0.14.2 before 0.15.0.

Proof of concept

1. Build a Markdown input consisting of a single line of 400,000 > characters. 2. Render it with MDEx.tohtml!(input, autoclose: true), or pass it as one chunk to MDEx.stream/2. 3. Observe the call takes over ten seconds, compared with under 150 ms for MDEx.tohtml!(input) without auto-close.

Impact

An 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.

1 / 2
Source: OSV
First published (updated )
Severity
2.1
AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N

Summary

Inefficient Regular Expression Complexity vulnerability in leandrocp mdex allows an attacker to exhaust CPU via crafted unterminated link or image labels.

When an application completes partial Markdown with the non-default autoclose: [links: :text] or autoclose: [images: :text] policy, MDEx.FragmentParser.textlabel/1 in lib/mdex/fragmentparser.ex escapes the pending label with two regular expressions, \A[^\n]+|[^\n]+\z and ~{3,}\z, that are anchored at one end only. The engine retries the unanchored alternative from every offset, so the cost grows with the square of a label line or trailing tilde run. An attacker who supplies the Markdown, such as user content or streamed LLM output, can make a single render of about 60 KB take tens of seconds of CPU. The default autoclose: true policy is not affected.

This issue affects mdex: from 0.14.3 before 0.15.0.

Details

1. Reaching the label. MDEx.FragmentParser.complete/2 (also reached through MDEx.tohtml/2 and the streaming document when autoclose is set) closes an unterminated link or image. Under the :text policy, pendinglink/3 and completelabel/3 hand the attacker's label to textlabel/1. The destination branch of completelink/4 lets the label span several lines, for example [a, a long middle line, then b](htt.

2. Quadratic matching. textlabel/1 runs Regex.replace with \A[^\n]+|[^\n]+\z. On a middle line the first alternative cannot match and the second consumes the whole line before failing at \z, and the engine repeats this from every later offset, so a line of N bytes costs about N squared steps. The trailing-tilde pass ~{3,}\z behaves the same way on a long run of tildes.

3. Effect. One render occupies a scheduler for seconds: a 60 KB label took about 23 s on mdex 0.14.9, against about 11 ms with the default policy, and quadrupling the input raised the time about 18 times.

Proof of concept

1. Use an application that renders untrusted Markdown with autoclose: [links: :text]. 2. Submit a fragment made of [a, a newline, 60 000 x characters, a newline, and b](htt, leaving the link unterminated. 3. Render it with MDEx.tohtml!/2 and those options. The call takes tens of seconds of CPU, while the same input with autoclose: true renders in milliseconds. 4. Alternatively, submit [~~~ followed by 40 000 ~ characters and x](htt to drive the trailing-tilde regex.

Impact

An attacker who controls Markdown rendered with the :text auto-close policy can make each render consume seconds of CPU, slowing or stalling the application under repeated requests.

Configurations

The application must render or complete attacker-influenced Markdown with the :text completion policy for links or images, autoclose: [links: :text] or autoclose: [images: :text]. The default autoclose: true policy and rendering without autoclose are not affected.

1 / 2
Source: OSV
First published (updated )
Severity
2.1
AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N

Summary

Inefficient Algorithmic Complexity vulnerability in MDEx.FragmentParser in leandrocp mdex allows an attacker who controls streamed or auto-closed Markdown to cause a denial of service through CPU exhaustion. Any application that renders untrusted Markdown with MDEx.stream/2 or the autoclose option is affected, for example live previews or streamed LLM output.

While auto-closing the last paragraph, closebracket/5 in lib/mdex/fragmentparser.ex runs an unbounded forward scan of the link tail for every ](. When that scan finds no valid link, scanning resumes just after the ], so the next ]( rescans the same tail. Each closed link also re-filters every pending image opener. Repeated [](x (, [](x(, or ![ openers in one paragraph therefore cost quadratic time, and about 100 KB of input occupies a scheduler for over ten seconds.

This issue affects mdex: from 0.14.2 before 0.15.0.

Details

1. Entry. MDEx.stream/2 (auto-close on by default) and documents with autoclose call MDEx.FragmentParser.complete/2, which reaches incompleteparagraphlink/5 and openlink/5 for the last paragraph. Scanning stops at a blank line, so an attacker who never sends one keeps the whole input in scope.

2. Rescan. For every ](, closebracket/5 calls linktail/2, which scans forward without bound through baredestination/3, linktitleend/4 and linkclose/2. When the tail is :invalid, continueafterlink/2 resumes just after the ], so the next ]( rescans the same tail. An unterminated title ( or nested parentheses ( makes every scan run to the end of the paragraph.

3. Opener filtering. Each closed link runs Enum.filter/2 over every pending opener to keep only images. With ![ repeated N times followed by N closed links, that is N filters over N openers.

All three shapes cost O(N^2). The reporter measured 120 KB of [](x ( at 12.0 s in a one-chunk MDEx.stream/2, against about 10 ms for MDEx.tohtml!/1 without auto-close.

Proof of concept

1. Build a single paragraph of 20,000 repetitions of z (about 120 KB, no blank line). 2. Pass it as one chunk to MDEx.stream/2 and consume the stream. 3. Observe the call take over ten seconds, while MDEx.tohtml!/1 on the same input returns in about 10 ms. Doubling the input roughly quadruples the time.

Impact

An attacker who can submit Markdown to a streaming or auto-closing renderer can occupy a CPU scheduler for seconds per request with about 100 KB of input, slowing or denying rendering for other users.

Configurations

The application must render untrusted Markdown with auto-closing enabled: through MDEx.stream/2, where it is on unless autoclose: false is passed, or with the autoclose option set on a document. Rendering with the default options of MDEx.tohtml/2 and MDEx.parsedocument/2 does not run the affected scanner.

1 / 2
Source: OSV
First published (updated )
Severity
2.1
AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N

Summary

Incorrect 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.

MDEx.todelta/2 blanks link, wikilink and image URLs that its dangerous-URL check flags, but renderurl/2 in lib/mdex/deltaconverter.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.

This issue affects mdex: from 0.13.2 before 0.15.0.

Details

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.

2. Unnormalized check. renderurl/2 in lib/mdex/deltaconverter.ex asks MDExNative.Comrak.dangerousurl?/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.

3. Emission. The Link, Image and WikiLink clauses of defaultconvertnode/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.

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.

Proof of concept

1. Convert plain) tab) !img) lead) with MDEx.todelta/2 and default options. 2. 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). 3. Place the tab link value into an <a href> and click it: the browser strips the tab and runs javascript:alert(1).

Impact

An 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.

Configurations

The application must pass untrusted Markdown to MDEx.todelta/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.

1 / 2
Source: OSV
First published (updated )
Severity
2.1
AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:L/SA:N

Summary

Improper Neutralization of Escape, Meta, or Control Sequences vulnerability in leandrocp mdex allows Slack mention and broadcast injection via link, image, and wikilink destinations. MDEx.toslack/2 renders these nodes as Slack <url|label> links and writes the destination between the angle brackets without rejecting Slack control prefixes. A destination such as !channel, !here, @U012AB3CD or !subteam^ID therefore comes out as <!channel|label> or <@U012AB3CD|label>, which Slack treats as a broadcast or a user or group mention. The same sequences in plain text are escaped.

Anyone whose Markdown an application forwards to Slack through MDEx.toslack/2 (user content, tickets, LLM output) can make the posting bot notify a whole channel or ping arbitrary users and groups. In lib/mdex/slackconverter.ex, renderurl/2 only drops URLs that the dangerous-URL check flags, and escapelinkpart/1 only escapes &, <, > and |.

This issue affects mdex: from 0.13.1 before 0.15.0.

Proof of concept

1. Call MDEx.toslack!("plain <!channel> read this !logo ping grp"). 2. Observe the output plain &lt;!channel&gt; <!channel|read this> <!here|logo> <@U012AB3CD|ping> <!subteam^SAZ94GDB8|grp>: the plain-text sequence is escaped, the link and image destinations are emitted as live Slack control sequences. 3. With extension: [wikilinkstitleafterpipe: true], [[!channel|x]] renders as <!channel|x>.

Impact

An attacker who controls Markdown that an application posts to Slack via MDEx.toslack/2 can trigger @channel/@here broadcasts and ping arbitrary users or user groups from the application's bot.

1 / 2
Source: OSV
First published (updated )
Severity
2.1
AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N

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.

When Markdown is rendered with autoclose: 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 expandquoteprefix/2 in lib/mdex/fragmentparser.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.

This issue affects mdex: from 0.14.2 before 0.15.0.

Proof of concept

1. Build a Markdown input consisting of a single line of 400,000 > characters. 2. Render it with MDEx.tohtml!(input, autoclose: true), or pass it as one chunk to MDEx.stream/2. 3. Observe the call takes over ten seconds, compared with under 150 ms for MDEx.tohtml!(input) without auto-close.

Impact

An 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.

1 / 2
Source: OSV
First published (updated )

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203