Mistune: XSS via unescaped class option in Admonition directive
Description
Published by the National Vulnerability Database
Jul 8, 2026
Published to the GitHub Advisory Database
Jul 20, 2026
Reviewed
Jul 20, 2026
Last updated
Jul 20, 2026
In
src/mistune/directives/admonition.py, therender_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.
References