---
id: "CVE-2026-115351"
kind: "vulnerability"
aliases: ["CVE-2026-115351"]
title: "Mistune: unvalidated figure directive option lets markdown inject CSS"
severity: "medium"
cvss: 5.3
epss: 0.00221
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["mistune", "package", "python", "user-generated-content"]
not_affected_if: ["no-figure-directive", "trusted-markdown-only"]
published_at: "2026-10-22T19:17:40+00:00"
first_seen_at: "2026-10-23T21:57:31+00:00"
updated_at: "2026-10-25T04:19:03+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-115351", "first_seen_at": "2026-10-23T21:57:31+00:00"}, {"source": "epss", "url": "https://api.first.org/data/v1/epss?cve=CVE-2026-115351", "first_seen_at": "2026-10-24T07:15:51+00:00"}]
---

# Mistune: unvalidated figure directive option lets markdown inject CSS

Mistune, a Python Markdown parser, does not validate the figwidth option of its figure directive, so attacker-controlled markdown can add arbitrary CSS declarations to rendered output. An attacker can use this to make victim browsers request URLs on attacker servers and leak attribute values.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Run `pip show mistune` and check whether the version is at least `3.2.1` and below `3.3.0`
- Search the codebase for `figure` directives or `figwidth` usage in rendered markdown

## Fix

- Upgrade mistune to `3.3.0` or later

## Timeline

- 2026-10-23T21:57:31+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-115351
- 2026-10-24T07:15:51+00:00 epss https://api.first.org/data/v1/epss?cve=CVE-2026-115351

## From the sources

Mistune from 3.2.1 before 3.3.0 contains a CSS injection vulnerability that allows attackers controlling markdown input to inject arbitrary style declarations via the unvalidated figwidth option of the figure directive. Attackers can append declarations like background:url() to the rendered figure style attribute, forcing victim browsers to send requests to attacker servers and leak attribute values.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
