Vulnerabilities in pkg:pypi/markdown2
PACKAGECVE-2021-26813 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Markdown2 libraries in the PyPI ecosystem. The issue involves markdown2 regular expression denial of service. Remediation is available by upgrading affected packages to version 2.4.0.
pkg:pypi/markdown2
Vulnerability advisories affecting package pkg:pypi/markdown2. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-jr9p-r423-9m2r | CVE-2021-26813 | HIGH | markdown2 Regular Expression Denial of Service |
| GHSA-p6h9-gw49-rqm4 | CVE-2018-5773 | MODERATE | markdown2 is vulnerable to cross-site scripting |
| GHSA-72cx-5ff9-4hhc | CVE-2009-3724 | MODERATE | Cross-site scripting in markdown2 for python |
| GHSA-fv3h-8x5j-pvgq | CVE-2020-11888 | MODERATE | XSS in python-markdown2 |
CVE-2021-26813 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2021-26813
To remediate this vulnerability, upgrade all affected Markdown2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install markdown2>=2.4.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show markdown2
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2021-26813, inspect your installed packages using pip:
pip show markdown2
Analyze the terminal output to locate any version of Markdown2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.4.0), your application is affected.
Note: The pip show markdown2 command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Markdown2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-26813 Affected Markdown2 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
markdown2
|
PyPI |
≥ 1.0.1.18
< 2.4.0
|
2.4.0
|
References
Frequently Asked Questions
What is CVE-2021-26813?
Which Markdown2 versions are affected?
What version fixes CVE-2021-26813?
Is markdown2 affected?
What is the CVSS score of CVE-2021-26813?
What CWE is associated with CVE-2021-26813?
How can I check PyPI dependencies for CVE-2021-26813?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-jr9p-r423-9m2r",
"modified" : "2024-09-30T20:15:06Z",
"published" : "2021-06-02T21:44:28Z",
"aliases" : [ "CVE-2021-26813" ],
"summary" : "markdown2 Regular Expression Denial of Service ",
"details" : "markdown2 >=1.0.1.18, fixed in 2.4.0, is affected by a regular expression denial of service vulnerability. If an attacker provides a malicious string, it can make markdown2 processing difficult or delayed for an extended period of time.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "markdown2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.0.1.18"
}, {
"fixed" : "2.4.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-26813"
}, {
"type" : "WEB",
"url" : "https://github.com/trentm/python-markdown2/pull/387"
}, {
"type" : "WEB",
"url" : "https://github.com/trentm/python-markdown2/commit/7b651260739647de5198323e0445b1618750c374"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-jr9p-r423-9m2r"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/markdown2/PYSEC-2021-20.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/trentm/python-markdown2"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BRP5RN35JZTSJ3JT4722F447ZDK7LZS5"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/J752422YELXLMLZJPVJVKD2KKHHQRVEH"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/JTIX5UXRDJZJ57DO4V33ZNJTNKWGBQLY"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1333" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-05-12T21:02:47Z",
"nvd_published_at" : "2021-03-03T16:15:00Z"
}
}