XSS Vulnerability in Mistune Package: Exploitable via Unexpected Newlines

mistune Updated 02 Oct 2025

Summary

19/10/2017
N/A
Yes i
Medium
6.1

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 across 2 version ranges.

< 0.8-1 < 714e60a20a7efe0923bc39991d989b3ef3324690

Fixed in 0.8-1. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Mistune is a popular Markdown parser for Python, designed to convert Markdown text into HTML. It is widely used in various applications due to its speed and ease of use. However, versions prior to 0.8-1 are vulnerable to a cross-site scripting (XSS) attack, which can occur when unexpected newlines or crafted email addresses are processed incorrectly.

Vulnerability Detail

The vulnerability in Mistune arises from improper handling of newlines in user input, particularly in the escape and autolink functions. This flaw allows attackers to inject malicious scripts into web pages, leading to potential data theft, session hijacking, or other malicious activities. The issue is particularly concerning as it can be exploited without user authentication, making it accessible to any user interacting with the affected application.

How To Fix

Minimum fixed version

0.8-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade mistune

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading is not immediately possible, consider sanitizing user input to remove unexpected newlines and validate email addresses before processing them. Implementing a robust input validation mechanism can help mitigate the risk of XSS attacks until the package can be updated.

Conclusion

The XSS vulnerability in the Mistune package poses a significant risk to applications using versions prior to 0.8-1. It is crucial for developers to upgrade to the latest version and implement input validation measures to protect against potential attacks. Utilizing tools like Vulert can aid in monitoring for such vulnerabilities in real-time.

See every vulnerability recorded for mistune →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 6.1, indicating a medium severity level.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Simply upload your manifest file like package-lock.json to check for vulnerabilities.

Exploiting this vulnerability can lead to XSS attacks, allowing attackers to steal sensitive information, hijack user sessions, or perform actions on behalf of users.

Yes, you can sanitize user inputs and implement strict validation for newlines and email addresses to reduce the risk of exploitation until an upgrade can be performed.

Detailed information can be found in the CVE database or through the official Mistune GitHub repository.

Related vulnerabilities

Recent vulnerabilities recorded for mistune.

How To Fix

Minimum fixed version

0.8-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade mistune

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback