Denial of Service Vulnerability in python-markdown2 Package
Summary
DEBIAN-CVE-2021-26813: markdown2 >=1.0.1.18, fixed in 2.4.0, is affected by a regular expression denial of service vulnerability. Affects python-markdown2 versions < 2.3.10-1.1. Fixed in 2.3.10-1.1. How to fix ↓
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
The python-markdown2 package is a popular Python library that allows users to convert Markdown text into HTML. It is widely used due to its simplicity and flexibility, enabling developers to easily integrate Markdown processing into their applications. However, a vulnerability has been identified in versions of markdown2 prior to 2.4.0, which can lead to performance issues when processing malicious input.
Vulnerability Detail
The vulnerability in question is a regular expression denial of service (ReDoS) issue present in markdown2 versions >=1.0.1.18 and fixed in version 2.4.0. This vulnerability arises when an attacker provides a specially crafted string that exploits the regex patterns used in the markdown2 processing. The result can be significant delays or even crashes in the application, making it difficult for legitimate users to process Markdown content. This can lead to service disruptions and potential denial of service.
How To Fix
Minimum fixed version
2.3.10-1.1
This is the first release that contains the fix.
sudo apt-get install --only-upgrade python-markdown2
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, you can validate and sanitize input strings before processing them with markdown2 to mitigate the risk of denial of service. This can be done by implementing input length checks and rejecting overly complex or long strings.
Conclusion
The python-markdown2 package has a vulnerability that can lead to denial of service due to regex processing issues. It is crucial to update to version 2.4.0 or later to protect your applications from potential disruptions. Additionally, consider using Vulert for ongoing vulnerability monitoring.
See every vulnerability recorded for python-markdown2 →
FAQ
The vulnerability can lead to significant delays in processing Markdown content, potentially causing denial of service for users.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
Versions of python-markdown2 prior to 2.4.0 are affected by this vulnerability.
Yes, Vulert can monitor and alert you in real-time for open-source vulnerabilities using just a manifest file like package-lock.json.
If an immediate update is not possible, implement input validation and sanitization as a temporary measure to mitigate the risk.
References
Related vulnerabilities
Recent vulnerabilities recorded for python-markdown2.