High severity8.8NVD Advisory· Published Dec 21, 2016· Updated May 6, 2026
CVE-2016-5851
CVE-2016-5851
Description
python-docx before 0.8.6 allows context-dependent attackers to conduct XML External Entity (XXE) attacks via a crafted document.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
python-docxPyPI | < 0.8.6 | 0.8.6 |
Patches
161b40b161b64oxml: don't resolve XML entities in oxml_parser
2 files changed · +2 −2
docx/opc/oxml.py+1 −1 modified@@ -16,7 +16,7 @@ # configure XML parser element_class_lookup = etree.ElementNamespaceClassLookup() -oxml_parser = etree.XMLParser(remove_blank_text=True) +oxml_parser = etree.XMLParser(remove_blank_text=True, resolve_entities=False) oxml_parser.set_element_class_lookup(element_class_lookup) nsmap = {
docx/oxml/__init__.py+1 −1 modified@@ -14,7 +14,7 @@ # configure XML parser element_class_lookup = etree.ElementNamespaceClassLookup() -oxml_parser = etree.XMLParser(remove_blank_text=True) +oxml_parser = etree.XMLParser(remove_blank_text=True, resolve_entities=False) oxml_parser.set_element_class_lookup(element_class_lookup)
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
15- www.openwall.com/lists/oss-security/2016/06/28/7nvdMailing ListPatchThird Party AdvisoryWEB
- github.com/python-openxml/python-docx/blob/v0.8.6/HISTORY.rstnvdPatchRelease NotesVendor AdvisoryWEB
- www.openwall.com/lists/oss-security/2016/06/28/8nvdMailing ListThird Party AdvisoryWEB
- www.securityfocus.com/bid/91485nvdThird Party AdvisoryVDB EntryWEB
- github.com/advisories/GHSA-34wj-p5jm-2p96ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2016-5851ghsaADVISORY
- github.com/pypa/advisory-database/tree/main/vulns/python-docx/PYSEC-2016-21.yamlghsaWEB
- github.com/python-openxml/python-docx/commit/61b40b161b64173ab8e362aec1fd197948431bebnvdWEB
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6FFMOH7ZPOPQWNJGUZOS5LXX4MGNRXXTghsaWEB
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/XU2WSYRNB7CLBBFCGSX34XHACTA2SWDZghsaWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/6FFMOH7ZPOPQWNJGUZOS5LXX4MGNRXXTghsaWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XU2WSYRNB7CLBBFCGSX34XHACTA2SWDZghsaWEB
- web.archive.org/web/20170214030949/http://www.securityfocus.com/bid/91485ghsaWEB
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6FFMOH7ZPOPQWNJGUZOS5LXX4MGNRXXT/nvd
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/XU2WSYRNB7CLBBFCGSX34XHACTA2SWDZ/nvd
News mentions
0No linked articles in our index yet.