Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-8c25-4j27-2rv3

Опубликовано: 20 июл. 2026
Источник: github
Github: Прошло ревью
CVSS3: 6.1

Описание

Mistune: XSS via percent-encoded javascript URI bypass in safe_url()

Summary

An XSS vulnerability in Mistune allows bypassing of safe_url() protections via percent-encoded javascript URIs.

Details

The vulnerability exists in HTMLRenderer.safe_url() in Mistune.

The function is intended to block harmful URL schemes such as "javascript:" by checking the prefix of the provided URL:

_url = url.lower() if _url.startswith(self.HARMFUL_PROTOCOLS): return "#harmful-link"

However, the input URL is not URL-decoded before this check. Because of this, an attacker can use percent-encoding to bypass the filter. For example:

javascript%3Aalert(1)

Since "%3A" is not decoded to ":", the check does not detect the "javascript:" scheme.

When rendered in a browser, the URL is decoded, resulting in execution of arbitrary JavaScript upon user interaction.

This effectively bypasses Mistune's built-in safe_url() protection mechanism.

PoC

  1. Install vulnerable version:

    pip install mistune==3.2.0

  2. Run the following code:

    import mistune

    markdown = mistune.create_markdown() html = markdown("j")

    print(html)

  3. Output:

    j

  4. Open the rendered HTML in a browser and click the link.

  5. The browser decodes "%3A" into ":" and executes:

    javascript:alert(1)

Impact

This is a cross-site scripting (XSS) vulnerability.

An attacker can craft a malicious Markdown link that executes JavaScript in the victim's browser when clicked.

Impact includes:

  • Session hijacking (e.g., cookie theft)
  • Execution of arbitrary JavaScript in the victim's context
  • Potential account takeover depending on the application

This affects any application that renders user-controlled Markdown using Mistune without additional URL sanitization.

Пакеты

Наименование

mistune

pip
Затронутые версииВерсия исправления

< 3.3.0

3.3.0

EPSS

Процентиль: 15%
0.00239
Низкий

6.1 Medium

CVSS3

Дефекты

CWE-79

Связанные уязвимости

CVSS3: 6.1
ubuntu
26 дней назад

Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.3.0, HTMLRenderer.safe_url() does not block percent-encoded javascript URIs, allowing attacker-supplied Markdown links or images to bypass URL protections and execute script in rendered HTML. This issue is fixed in version 3.3.0.

CVSS3: 6.1
redhat
26 дней назад

Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.3.0, HTMLRenderer.safe_url() does not block percent-encoded javascript URIs, allowing attacker-supplied Markdown links or images to bypass URL protections and execute script in rendered HTML. This issue is fixed in version 3.3.0.

CVSS3: 6.1
nvd
26 дней назад

Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.3.0, HTMLRenderer.safe_url() does not block percent-encoded javascript URIs, allowing attacker-supplied Markdown links or images to bypass URL protections and execute script in rendered HTML. This issue is fixed in version 3.3.0.

CVSS3: 6.1
debian
26 дней назад

Mistune is a Python Markdown parser with renderers and plugins. Prior ...

suse-cvrf
20 дней назад

Security update for python-mistune

EPSS

Процентиль: 15%
0.00239
Низкий

6.1 Medium

CVSS3

Дефекты

CWE-79