Am I affected?

type your mdex version to check

Description

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.

'Elixir.MDEx':to_delta/2 converts Markdown into a Quill Delta. 'Elixir.MDEx.DeltaConverter':default_convert_node/3 in lib/mdex/delta_converter.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](javascript:alert(document.cookie))) 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.

Weaknesses & attack patterns

Weakness

CWE-79 · Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in catalog → MITRE ↗

Attack patterns

CAPEC-244 · XSS Targeting URI Placeholders MITRE ↗

Affected — Hex / mdex Hex.pm ↗ Repository ↗

0.8.3 < 0.13.2 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:leandrocp:mdex:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.MDEx' · 'Elixir.MDEx.DeltaConverter'
source files lib/mdex.ex · lib/mdex/delta_converter.ex
routines 'Elixir.MDEx':to_delta/2 · 'Elixir.MDEx.DeltaConverter':convert/2 · 'Elixir.MDEx.DeltaConverter':default_convert_node/3

Affected — GitHub / leandrocp/mdex Repository ↗

9852db2 < 2817147 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:leandrocp:mdex:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.MDEx' · 'Elixir.MDEx.DeltaConverter'
source files lib/mdex.ex · lib/mdex/delta_converter.ex
routines 'Elixir.MDEx':to_delta/2 · 'Elixir.MDEx.DeltaConverter':convert/2 · 'Elixir.MDEx.DeltaConverter':default_convert_node/3

Workarounds

Sanitize the Quill Delta produced by 'Elixir.MDEx':to_delta/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 'Elixir.MDEx':to_delta/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).

References

Credits

Peter Ullrich Finder
Leandro Pereira Remediation developer
Jonatan Männchen / EEF Analyst

CVSS breakdown

CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N
« All CVEs