CVE-2017-15612: XSS Vulnerability in mistune
Summary
CVE-2017-15612: mistune.py in Mistune 0.7.4 allows XSS via an unexpected newline (such as in java\nscript:) or a crafted email address, related to the escape and autolink functions. Affects mistune versions < 0.8. Fixed in 0.8. How to fix ↓
Also tracked for
- mistune · Debian:11
The same CVE-2017-15612 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Mistune is a Python package available on PyPI that provides a Markdown parser and renderer. It is commonly used for converting Markdown text into HTML. The package is widely adopted and utilized in various applications and frameworks. However, a vulnerability has been discovered in version 0.7.4 of Mistune, which allows for cross-site scripting (XSS) attacks. This vulnerability arises from unexpected newlines or crafted email addresses, which can bypass the escape and autolink functions of Mistune.
Vulnerability Detail
The XSS vulnerability in Mistune 0.7.4 allows an attacker to inject malicious code into the generated HTML output. This can lead to various security risks, including the execution of arbitrary JavaScript code in the context of the victim's browser. The vulnerability can be triggered by inserting a newline character (e.g., java\nscript:) or by using a specially crafted email address. The escape and autolink functions of Mistune fail to properly sanitize and validate these inputs, resulting in the execution of the injected code.
How To Fix
Latest published version: 3.4.0 as of 22 Oct 2026
pip install --upgrade "mistune==3.4.0"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
0.8
This is the first release that contains the fix.
pip install --upgrade "mistune==0.8"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Conclusion
The XSS vulnerability in Mistune 0.7.4 poses a significant security risk, allowing for the execution of arbitrary JavaScript code. To mitigate this risk, it is essential to upgrade to version 0.8 or later of Mistune. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for mistune →
FAQ
The vulnerability allows an attacker to execute arbitrary JavaScript code in the victim's browser, potentially leading to unauthorized access, data theft, or other malicious activities.
At present, there is no known workaround for this vulnerability. It is recommended to upgrade to the fixed version of Mistune to mitigate the risk.
No, only version 0.7.4 of Mistune is affected. Versions 0.8 and later have addressed this vulnerability.
There is no information available regarding active exploitation of this vulnerability in the wild. However, it is crucial to apply the recommended fix to prevent potential attacks.
You can find more information about this vulnerability in the Mistune advisory database: https://github.com/pypa/advisory-database/blob/main/vulns/mistune/PYSEC-2017-80.yaml
References
Related vulnerabilities
Recent vulnerabilities recorded for mistune.