Description
PyPy before versions 3.11.16 and 3.12.14 contains a use-after-free vulnerability in the pyexpat module's ExternalEntityParserCreate function that allows attackers to corrupt memory by supplying a crafted XML document to applications that create external-entity sub-parsers without retaining a reference to the parent parser. The child parser retains a raw C back-pointer to the parent parser struct while PyPy's tracing garbage collector can free the parent's C struct, causing bundled libexpat to dereference the freed pointer on every parsed token, producing memory corruption.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| PyPy | PyPy | < 3.11.16, 3.12.0 – < 3.12.14 | 3.11.16 |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | pypy3 | 8.0.0+dfsg-1 | — |
| Debian 13 | pypy3 | No fix yet | — |
| Debian 12 | pypy3 | No fix yet | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | pypy3 | No fix yet | — |
| Ubuntu 26.04 LTS | pypy3 | No fix yet | — |
| Ubuntu 24.04 LTS | pypy3 | No fix yet | — |
| Ubuntu 22.04 LTS | pypy3 | No fix yet | — |
| Ubuntu 20.04 LTS | pypy3 | No fix yet | — |
References
- Release Notes release-notes
- PyPy release-pypy3.12-v8.0.0 Release Notes patch release-notes
- PyPy release-pypy3.11-v8.0.0 Release Notes patch release-notes
- https://www.vulncheck.com/advisories/pypy-pyexpat-externalentityparsercreate-use-after-free third-party-advisory