CVE-2026-59926

Mistune: XSS via unescaped class option in Admonition directive

Published Jul 8, 2026 CVSS 4.0 · 5.3 Medium EPSS < 1% KEV · Not listed
Description
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, render_admonition() in src/mistune/directives/admonition.py concatenates the Admonition directive :class: option into the HTML class attribute without escaping, allowing attribute injection and cross-site scripting even when HTMLRenderer escape mode is enabled. This issue is fixed in version 3.2.1.

Analysis

AI-generated

Technical impact

Mistune, a Python Markdown parser, allows unescaped HTML class values from the :class: option of its Admonition directive to be concatenated directly into rendered HTML. This missing escaping creates a classic input validation flaw that lets an attacker inject arbitrary HTML attributes, such as JavaScript event handlers, into the page. The malicious script runs in the context of the user’s browser, enabling session hijacking, data theft or defacement when the rendered markdown is displayed. The vulnerability is only exploitable where user‑supplied markdown is rendered and delivered to a browser.

Affected Systems

The flaw impacts any application that incorporates the Mistune parser from lepture, version older than 3.2.1, and renders Markdown containing the Admonition directive. If the directive is not disabled or the :class: option is not filtered, user‑supplied content can inject arbitrary HTML attributes. Open‑source projects and other software that depend on Mistune directly or indirectly are potential targets, but only those that use the vulnerable directive in a context that displays the rendered HTML.

Risk and Exploitability

The CVSS score of 5.3 places the flaw in the moderate range, but exploitation is straightforward, requiring only crafted markdown. No additional privileges or network access are necessary beyond the ability to supply or influence the markdown content. The EPSS score of <1% indicates a very low probability of exploitation. Based on the description, it is inferred that the attack likely occurs in an HTTP context where the rendered markdown is delivered to a browser, resulting in client‑side code execution. The vulnerability is not listed in the CISA KEV catalogue.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Mistune to version 3.2.1 or later where the :class: option is properly escaped.
  • If an upgrade is not yet possible, disable the Admonition directive or strip the :class: option from user‑supplied markdown before rendering.
  • Configure downstream applications to sanitize or whitelist only safe HTML attributes after rendering to further mitigate injection risk.

Generated by OpenCVE AI on August 1, 2026 at 15:55 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-g97x-gvcm-x72h Mistune: XSS via unescaped class option in Admonition directive
History
Type Values Removed Values Added
References
Metrics threat_severity

None

cvssV3_1

{'score': 5.4, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N'}

threat_severity

Moderate

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Lepture
Lepture mistune
Vendors & Products Lepture
Lepture mistune
Type Values Removed Values Added
Description Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, render_admonition() in src/mistune/directives/admonition.py concatenates the Admonition directive :class: option into the HTML class attribute without escaping, allowing attribute injection and cross-site scripting even when HTMLRenderer escape mode is enabled. This issue is fixed in version 3.2.1.
Title Mistune: XSS via unescaped class option in Admonition directive
Weaknesses CWE-79
References
Metrics cvssV4_0

{'score': 5.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N'}

Weaknesses
  • CWE-79

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

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jul 8, 2026, 7:40 PM
Reserved
Jul 7, 2026, 6:20 PM
Status
Analyzed
Published
Jul 8, 2026, 5:17 PM
Modified
Oct 25, 2026, 5:10 PM
Severity
Moderate
Public date
Jul 8, 2026, 4:16 PM