Skip to content

XSS via unescaped class option in Admonition directive

Moderate
lepture published GHSA-g97x-gvcm-x72h Jun 21, 2026

Package

pip mistune (pip)

Affected versions

<= 3.2.0

Patched versions

3.3.0

Description

In src/mistune/directives/admonition.py, the render_admonition() function concatenates the :class: option directly into the HTML class attribute without escaping (lines 63-68).

This allows attribute injection and XSS even when HTMLRenderer(escape=True) is used.

The directive name parameter is safe (validated against whitelist), but the class option comes from raw user input.

Severity

Moderate

CVE ID

CVE-2026-59926

Weaknesses

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. Learn more on MITRE.

Credits