# Improper Restriction of XML External Entity Reference in python-docx

Advisory record · `GHSA-34wj-p5jm-2p96`

- **Identifiers:** `GHSA-34wj-p5jm-2p96` · `CVE-2016-5851` · `PYSEC-2016-21`
- **State:** Confirmed
- **Severity:** CVSS 8.8 High
- **Critical:** No
- **Weakness (CWE):** [CWE-611](https://cwe.mitre.org/data/definitions/611.html)
- **Tags:** [XML external entities (XXE)](https://agentprime.io/advisories/tag/xxe.md)
- **Published:** 13 May 2022
- **Updated:** 25 Oct 2024
- **Reviewed by a person:** No

Published by the GitHub Advisory Database at 13 May 2022, 01:06 UTC. agentprime has not analysed this yet, so whether it affects any app is not known.

## Affected packages

- `python-docx` (PyPI): affected `<0.8.6`; fixed in `0.8.6`

## Not analysed yet

We haven’t published our analysis of this Advisory yet. Once a person has reviewed it, this page will say what’s vulnerable, what has to be true for your app to be affected, and how to check.

## Severity and exploitation

- 8.8 High, CVSS 3.1: `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`, from GitHub Advisory Database

- **CISA KEV:** Not listed.
- **EPSS:** 0.024, the 83rd percentile, on 11 Nov 2026: FIRST’s estimate of the chance of exploitation in the next 30 days.

## Timeline

This record came from the full history of the GitHub Advisory Database, published 13 May 2022. New records show when each source confirmed them.

## Sources

- [GitHub Advisory Database: GHSA-34wj-p5jm-2p96](https://github.com/advisories/GHSA-34wj-p5jm-2p96)
- [OSV: GHSA-34wj-p5jm-2p96](https://osv.dev/vulnerability/GHSA-34wj-p5jm-2p96)
- <https://nvd.nist.gov/vuln/detail/CVE-2016-5851>
- <https://github.com/python-openxml/python-docx/commit/61b40b161b64173ab8e362aec1fd197948431beb>
- <https://github.com/advisories/GHSA-34wj-p5jm-2p96>
- <https://github.com/pypa/advisory-database/tree/main/vulns/python-docx/PYSEC-2016-21.yaml>
- <https://github.com/python-openxml/python-docx>
- <https://github.com/python-openxml/python-docx/blob/v0.8.6/HISTORY.rst>
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6FFMOH7ZPOPQWNJGUZOS5LXX4MGNRXXT>
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/XU2WSYRNB7CLBBFCGSX34XHACTA2SWDZ>
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/6FFMOH7ZPOPQWNJGUZOS5LXX4MGNRXXT>
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XU2WSYRNB7CLBBFCGSX34XHACTA2SWDZ>
- <https://web.archive.org/web/20170214030949/http://www.securityfocus.com/bid/91485>
- <http://www.openwall.com/lists/oss-security/2016/06/28/7>

Facts on this page come from the GitHub Advisory Database (CC-BY 4.0), OSV and the other sources listed, as published. We don’t reproduce full advisory descriptions, which can contain exploit code.

## Check whether this affects you

A Match means an installed version is in the affected range above. Most don’t affect the app; agentprime hasn’t analysed this one yet.

- With the agentprime MCP server (<https://api.agentprime.io/mcp>), ask your agent to check the project: `check_lockfile` sends a lockfile, `check_packages` a list of installed packages, and both return the Matches and the upgrades that clear them. `get_advisory` returns this record. Setup: <https://agentprime.io/mcp.md>
- In a browser: <https://agentprime.io/check/> reads your lockfile in the browser, never uploading it.
- Whether it touches your code, with file and line: the Claude Code plugin, <https://agentprime.io/plugin.md>
- As JSON: <https://api.agentprime.io/v1/advisories/GHSA-34wj-p5jm-2p96>, or `POST https://api.agentprime.io/v1/match` with your packages (<https://agentprime.io/api.md>)

---

The web page: <https://agentprime.io/advisories/GHSA-34wj-p5jm-2p96/>. Everything for agents: <https://agentprime.io/llms.txt>.
