Miggo Logo

CVE-2016-5851: Improper Restriction of XML External Entity Reference in python-docx

8.8

CVSS Score
3.1

Basic Information

EPSS Score
0.74662%
Published
5/13/2022
Updated
10/25/2024
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
python-docxpip<= 0.8.50.8.6

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability arises from the use of XML parsers configured to resolve external entities in two files: 'docx/opc/oxml.py' and 'docx/oxml/init.py'. In versions ≤0.8.5, these parsers were initialized with resolve_entities=True (the default), enabling XXE attacks. The patch explicitly sets resolve_entities=False in both locations. These parsers are used to process XML content in DOCX files, and their insecure configuration allowed malicious documents to trigger entity resolution, leading to the XXE vulnerability.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

pyt*on-*o*x ***or* *.*.* *llows *ont*xt-**p*n**nt *tt**k*rs to *on*u*t XML *xt*rn*l *ntity (XX*) *tt**ks vi* * *r**t** *o*um*nt.

Reasoning

T** vuln*r**ility *ris*s *rom t** us* o* XML p*rs*rs *on*i*ur** to r*solv* *xt*rn*l *ntiti*s in two *il*s: '*o*x/op*/oxml.py' *n* '*o*x/oxml/__init__.py'. In v*rsions ≤*.*.*, t**s* p*rs*rs w*r* initi*liz** wit* r*solv*_*ntiti*s=Tru* (t** ****ult), *n