PyO3 Risk of buffer overflow in `PyString::from_object`
Key facts
- Attack vector
- —
- Privileges required
- —
- User interaction
- —
- Attack complexity
- —
- Impact type
- —
- Confidentiality · integrity · availability
- —
- Fix status
- Fixed
No CVSS vector from any source. Fix status from GitHub.
Summary
`PyString::from_object` took `&str` arguments and forwarded them directly to the Python C API without checking for terminating nul bytes. This could lead the Python interpreter to read beyond the end of the `&str` data and potentially leak contents of the out-of-bounds read (by raising a Python exception containing a copy of the data including the overflow). In PyO3 0.24.1 this function will now allocate a `CString` to guarantee a terminating nul bytes. PyO3 0.25 will likely offer an alternative API which takes `&CStr` arguments.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | pyo3 (crates.io) | 0.1.0 to before 0.24.1 | 0.24.1 | Patch available | GHSA-pph8-gcv7-4qj5 |
- pyo3 (crates.io) Vendor— Affected 0.1.0 to before 0.24.1 Fixed in 0.24.1 Patch available GHSA-pph8-gcv7-4qj5
Remediation
- Fix · GHSA-pph8-gcv7-4qj5 pyo3 (crates.io) Fixed in 0.24.1 Advisory →
Timeline
- 2026-10-03 Threatist record created from GHSA-pph8-gcv7-4qj5
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences