GHSA-47qc-857f-7w7f RUSTSEC-2026-0013
PyO3 has type confusion when accessing data from sublasses of subclasses of native types with `abi3` feature
- Severity
- 0.0 / 10
- High · CVSS 4.0
- Exploit chance (EPSS)
- —
- No score published
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-843 Access of Resource Using Incompatible Type ('Type Confusion')
- Fix
0.28.2- Upgrade pyo3 to this version or later
Description
PyO3 0.28.1 added support for #[pyclass(extends=PyList)] struct NativeSub (and other native types) when targeting Python 3.12 and up with the abi3 feature.
It was discovered that subclasses of such classes would use the type of the subclass when attempting to access to data of NativeSub contained within Python objects, amounting to memory corruption.
PyO3 0.28.2 fixed the issue by using the type of (e.g.) NativeSub correctly.
Affected versions
crates.io
| Package | Vulnerable | Fixed in |
|---|---|---|
| pyo3 | >= 0.28.0, < 0.28.2 |
0.28.2 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
pyo3 crates.io → 0.28.2
- cargo
cargo update -p pyo3 --precise 0.28.2
Severity breakdown
CVSS 4.0 0.0
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U
- Attack vector
- Network
- Attack complexity
- High
- Attack requirements
- Present
- Privileges required
- None
- User interaction
- None
- Confidentiality (vulnerable system)
- High
- Integrity (vulnerable system)
- High
- Availability (vulnerable system)
- High
- Confidentiality (subsequent systems)
- None
- Integrity (subsequent systems)
- None
- Availability (subsequent systems)
- None
- Exploit maturity
- Unreported
Weakness
CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')
The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.
References
Packages
Other links
Timeline
- Published
- Last updated by the source
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-chgr-c6px-7xpp PyO3 has a missing `Sync` bound on `PyCFunction::new_closure` closures | Medium | Also affects pyo3 |
| GHSA-36hh-v3qg-5jq4 PyO3 has an Out-of-bounds Read in `nth` / `nth_back` for `PyList` and `PyTuple` iterators | High | Also affects pyo3 |
| GHSA-pph8-gcv7-4qj5 PyO3 Risk of buffer overflow in `PyString::from_object` | Low | Also affects pyo3 |
| GHSA-vxcf-c7mx-pg53 Build corruption when using `PYO3_CONFIG_FILE` environment variable | Medium | Also affects pyo3 |
| GHSA-6jgw-rgmm-7cv6 PyO3 has a risk of use-after-free in `borrowed` reads from Python weak references | Medium | Also affects pyo3 |
| GHSA-2vx6-fcw6-hpr6 Reference counting error in pyo3 | Medium | Also affects pyo3 |
| GHSA-9pvw-hwfg-92h5 Wasmtime: Panic lowering a host-created component model stream into a guest that expects a different payload type | Medium | Same weakness, CWE-843 |
| GHSA-897f-g5gm-fmxm Wasmtime: Bit-packing in Cranelift compiler causes silent overflow and miscompilation | Critical | Same weakness, CWE-843 |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor