Vulnerabilities in pkg:pypi/XML2Dict
PACKAGECVE-2021-25951 is a HIGH (CVSS 7.5) xml2dict xml entity expansion vulnerability vulnerability (CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')) affecting XML2Dict libraries in the PyPI ecosystem. The issue involves xml2dict xml entity expansion vulnerability. Remediation is available in the latest vendor maintenance releases.
pkg:pypi/XML2Dict
Vulnerability advisories affecting package pkg:pypi/XML2Dict. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-gp6m-vqhm-5cm5 | CVE-2021-25951 | HIGH | XML2Dict XML Entity Expansion Vulnerability |
CVE-2021-25951 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-25951
To remediate this vulnerability, upgrade all affected XML2Dict 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 XML2Dict>=Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show XML2Dict
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2021-25951, inspect your installed packages using pip:
pip show XML2Dict
Analyze the terminal output to locate any version of XML2Dict in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: The pip show XML2Dict command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion'), where the product uses xml documents and allows their structure to be defined with a document type definition (dtd), but it does not properly control the number of recursive definitions of entities. In XML2Dict, 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-25951 Affected XML2Dict Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
XML2Dict
|
PyPI |
≤ 0.2.2
|
|
References
Frequently Asked Questions
What is CVE-2021-25951?
Which XML2Dict versions are affected?
What version fixes CVE-2021-25951?
Is XML2Dict affected?
What is the CVSS score of CVE-2021-25951?
What CWE is associated with CVE-2021-25951?
How can I check PyPI dependencies for CVE-2021-25951?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-gp6m-vqhm-5cm5",
"modified" : "2024-11-19T18:24:52Z",
"published" : "2021-07-02T18:37:31Z",
"aliases" : [ "CVE-2021-25951" ],
"summary" : "XML2Dict XML Entity Expansion Vulnerability",
"details" : "XXE vulnerability in 'XML2Dict' version 0.2.2 allows an attacker to cause a denial of service. The parse function does not properly restrict recursive entity references.",
"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" : "XML2Dict"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "0.2.2"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-25951"
}, {
"type" : "WEB",
"url" : "https://github.com/mcspring/XML2Dict/tree/master"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/mcspring/xml2dict"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/xml2dict/PYSEC-2021-349.yaml"
}, {
"type" : "WEB",
"url" : "https://pypi.org/project/XML2Dict"
}, {
"type" : "WEB",
"url" : "https://www.whitesourcesoftware.com/vulnerability-database/CVE-2021-25951"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-611", "CWE-776" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-07-01T21:42:31Z",
"nvd_published_at" : "2021-06-30T12:15:00Z"
}
}