Junglewise Threat Intelligence

CVE-2026-44899: lepture Mistune CSS injection in Image directive plugin

CVE-2026-44899 · Severity: medium · CVSS 4.7 · Published 2026-05-26

Technologies: Lepture Mistune. Vendors: PyPI.

Executive brief

Mistune is a Python library used to convert Markdown text into HTML. A vulnerability in its image processing plugin allows an attacker to inject malicious CSS code into a web page. This could be used to create deceptive overlays, such as fake login forms or phishing screens, that cover the legitimate content of a website.

Technical details

The Image directive plugin in Mistune uses a regular expression (`_num_re = re.compile(r"^\d+(?:\.\d*)?")`) that lacks an end-of-string anchor ($). Because validation is performed using `re.match()`, it only checks if the input starts with digits. If the input is not a plain integer (e.g., containing CSS units or malicious payloads), `render_block_image()` inserts the value directly into a `style` attribute without escaping. An attacker can provide a crafted `:width:` or `:height:` value containing a chain of CSS properties (e.g., `position:fixed; z-index:9999`). This allows for full-page UI redressing, phishing overlays, or other CSS-based attacks. The issue is fixed in version 3.2.1 by using a stricter regex.

Affected products

  • lepture mistune < 3.2.1

Timeline

  • 2026-05-03: patched: Version 3.2.1 released on GitHub.
  • 2026-05-12: advisory: GitHub Security Advisory GHSA-ccfx-mfmx-2fx9 published.
  • 2026-05-26: disclosed: CVE-2026-44899 published to NVD.

References

Related threats