---
id: CVE-2026-44896
aliases:
  - GHSA-58cw-g322-p94v
  - PYSEC-2026-168
title: Mistune has XSS via unescaped figclass/figwidth in Figure directive
summary: Mistune has XSS via unescaped figclass/figwidth in Figure directive
severity: medium
cvss: 6.1
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N'
vendor: mistune
product: mistune
ecosystem: pip
affected:
  - mistune < 3.2.1
patched:
  - mistune 3.2.1
published: '2026-05-08'
updated: '2026-09-10'
sourceUpdated: '2026-09-10T03:51:04.581184293Z'
source: OSV
sourceUrl: 'https://osv.dev/vulnerability/GHSA-58cw-g322-p94v'
references:
  - url: 'https://github.com/lepture/mistune/security/advisories/GHSA-58cw-g322-p94v'
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2026-44896'
  - url: >-
      https://github.com/lepture/mistune/commit/a3cb6e5655308797e8be021d6c7b5bab13cbace2
  - url: 'https://github.com/lepture/mistune'
  - url: >-
      https://github.com/pypa/advisory-database/tree/main/vulns/mistune/PYSEC-2026-168.yaml
tags:
  - osv
  - pip
epss: 0.00198
epssPercentile: 0.09915
ingestedAt: '2026-09-12T03:13:01.659Z'
---

## Overview

In `src/mistune/directives/image.py`, the `render_figure()` function concatenates `figclass` and `figwidth` options directly into HTML attributes without escaping (lines 152-168).

This allows attribute injection and XSS even when `HTMLRenderer(escape=True)` is used, because these values bypass the inline renderer.

Other attributes in the same file (src, alt, style) are properly escaped; figclass/figwidth were missed.

## Affected packages

- `mistune < 3.2.1`

## Remediation

Upgrade to a patched release:

- `mistune 3.2.1`
