CVE-2026-59929: Mistune URL Scheme Bypass Vulnerability – XSS Risk in Markdown Parser
Mistune, a popular Python Markdown parser, contains a vulnerability in its URL sanitization logic that fails to block certain legacy and less-common URL schemes. While it successfully blocks javascript:, vbscript:, file:, and data: URLs, attackers can bypass this protection by using alternative schemes like feed:, view-source:, jar:, or others to inject malicious links into rendered HTML. When users click these links or the content is processed by certain browsers, script execution may occur. This affects Mistune versions prior to 3.3.0.
Source data · NVD / CISA · public domain
- 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
- Weaknesses (CWE)
- CWE-184, CWE-79
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-07-08 / 2026-07-09
NVD description (verbatim)
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.3.0, the safe_url filter in src/mistune/renderers/html.py blocks only javascript:, vbscript:, file:, and data: schemes, allowing legacy or chained schemes such as feed:, view-source:, jar:, livescript:, mocha:, ms-its:, mk:, and res: to reach rendered href and src attributes and potentially execute script in affected user agents. This issue is fixed in version 3.3.0.
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The safe_url filter in Mistune's HTML renderer implements an allowlist-style block for dangerous URL schemes, but the implementation is incomplete. It restricts only javascript:, vbscript:, file:, and data: schemes—omitting a broader set of dangerous legacy and protocol-chained schemes (feed:, view-source:, jar:, livescript:, mocha:, ms-its:, mk:, and res:). An attacker can craft Markdown content with hrefs or src attributes using these unblocked schemes. When the Markdown is rendered to HTML and displayed in a user agent that interprets these schemes, arbitrary script execution becomes possible. The vulnerability is rooted in an incomplete understanding of the full namespace of exploitable URL schemes across different browsers and user agents.
Business impact
Organizations relying on Mistune to sanitize user-generated or untrusted Markdown content face elevated XSS risk. If your application renders Markdown from user input and displays it to other users—common in comment systems, wikis, collaborative platforms, or documentation tools—an attacker can inject malicious payloads that execute in the browsers of your users. This could lead to session hijacking, credential theft, malware distribution, or defacement. The impact depends on the sensitivity of the application and the trust level of the Markdown sources.
Affected systems
Mistune versions prior to 3.3.0 are affected. This includes all 3.2.x and earlier releases. Any Python application using Mistune to render Markdown without additional external sanitization is at risk. Applications that already implement additional URL scheme validation (e.g., using external HTML sanitizers like Bleach) may have partial or complete protection depending on their configuration.
Exploitability
Exploitation requires user interaction (clicking a link or visiting a page with the malicious Markdown) and depends on the user agent's handling of the unblocked schemes. Browsers have varying levels of support for legacy schemes, making the exploit reliability inconsistent across client environments. The CVSS score of 6.1 (Medium) reflects the need for user interaction and the context-dependent nature of exploitation, though the attack surface can be broad in applications that process large volumes of user-generated Markdown.
Remediation
Upgrade Mistune to version 3.3.0 or later, which corrects the safe_url filter to block a comprehensive set of dangerous URL schemes. Additionally, consider implementing defense-in-depth by layering a secondary HTML sanitization library (such as Bleach or Nh3) on top of Mistune's output. This ensures that even if Mistune's filtering is incomplete, a stricter allowlist-based sanitizer provides additional protection.
Patch guidance
Update your Mistune dependency to version 3.3.0 or later. In requirements.txt or setup.py, change mistune to mistune>=3.3.0. After updating, test your Markdown rendering pipeline to ensure no regressions in legitimate content display. Verify that links and image sources in your test corpus still render correctly.
Detection guidance
Monitor for Markdown content containing URLs with schemes like feed:, view-source:, jar:, livescript:, mocha:, ms-its:, mk:, or res: attributes. Automated scanning of user-submitted Markdown or comments for these patterns can flag suspicious submissions. Review browser console logs and user reports of unexpected script execution on pages displaying Markdown. If using a web application firewall (WAF), configure rules to detect or block these scheme patterns in request payloads.
Why prioritize this
While the CVSS score is Medium, the practical risk depends on your application's use case. Prioritize this highly if you: (1) render user-generated Markdown to other users, (2) lack secondary sanitization layers, or (3) operate in high-trust or sensitive environments. Prioritize it moderately if Markdown sources are internal or trusted, or if you already employ additional HTML sanitization. The incomplete scheme list makes this a subtle but persistent vulnerability.
Risk score, explained
The CVSS 3.1 score of 6.1 reflects a network-based attack requiring no privileges, low attack complexity, but mandatory user interaction and cross-site scope implications. It carries confidentiality and integrity impact but no availability impact. The score appropriately penalizes the requirement for user action while acknowledging the broad scope of potential affected users and the ability to compromise sensitive information or deface content.
Frequently asked questions
Does this vulnerability affect my application if I strip all HTML tags before rendering Markdown?
No. If you process Markdown only after stripping or escaping user input of HTML/XML tags, the attack vector is significantly reduced. However, if users are allowed to include Markdown-compatible syntax (including links), you should still upgrade Mistune to ensure defensive consistency.
Can I use Mistune 3.3.0 without other sanitization libraries?
Mistune 3.3.0 closes this particular bypass, but relying solely on any single sanitizer is not recommended for production systems handling untrusted user input. Layering additional HTML sanitization (e.g., Bleach) provides defense-in-depth and protects against other potential bypasses or future vulnerabilities in Mistune.
What is the difference between the schemes Mistune now blocks versus before?
Prior to 3.3.0, Mistune blocked only javascript:, vbscript:, file:, and data:. Version 3.3.0 extends this to include feed:, view-source:, jar:, livescript:, mocha:, ms-its:, mk:, res:, and potentially others. The updated list reflects a more comprehensive understanding of dangerous legacy and protocol-chained schemes.
If our Markdown sources are all internal and trusted, do we still need to patch?
If you fully control all Markdown sources and can guarantee no untrusted input, the immediate risk is lower. However, patching is still recommended for future-proofing, reducing technical debt, and ensuring consistency across environments. If there is any possibility of supply chain compromise or insider threats, patching provides valuable defense-in-depth.
This analysis is based on CVE-2026-59929 published data and vendor information as of July 2026. Specific application risk varies based on implementation, input sources, and downstream sanitization. Always consult the official Mistune project advisory and your vendor's guidance before deploying patches. This page does not constitute legal or compliance advice. Test patches in a non-production environment before broad deployment. Source: NVD (public-domain), retrieved 2026-08-17. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-44587MEDIUMCarrierWave Content-Type Denylist Regex Bypass (Stored XSS)
- CVE-2026-54070HIGHSiYuan Marketplace README XSS Leads to Admin Workspace Compromise
- CVE-2026-59923MEDIUMMistune Percent-Encoded JavaScript URI Bypass in HTML Rendering
- CVE-2026-59926MEDIUMMistune Markdown Parser XSS via Attribute Injection
- CVE-2016-20070MEDIUMPrivilege Escalation & Stored XSS in WordPress Booking Calendar Contact Form 1.0.23
- CVE-2018-25384MEDIUMStored XSS in Wikidforum 2.20 Allows Authenticated Attackers to Inject Malicious Scripts
- CVE-2019-25731MEDIUMStored XSS in Zuz Music 2.1 Contact Form
- CVE-2019-25737MEDIUMStored XSS in Live Chat Unlimited 2.8.3 – Admin Session Compromise