Every CVESearch/Get API key

GHSA-pph8-gcv7-4qj5

PyO3 Risk of buffer overflow in `PyString::from_object`

2.9 LowFix available

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.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
None
Integrity
None
Availability
Low

What each source reports

GitHub Advisories Score used2.9

PyO3 Risk of buffer overflow in `PyString::from_object`

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.

Record
GHSA-pph8-gcv7-4qj5
CVSS 4.0
2.9 LowCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:P
Weakness
CWE-125
Updated
2026-11-02
OSV2.9

PyO3 Risk of buffer overflow in `PyString::from_object`

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.

Record
GHSA-pph8-gcv7-4qj5
CVSS 4.0
2.9 LowCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:P
Weakness
CWE-125
Updated
2026-11-02
OSVRUSTSEC-2025-0020No score

Risk of buffer overflow in `PyString::from_object`

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.

Record
RUSTSEC-2025-0020
Updated
2026-11-02

Affected packages

Affected packages
PackageAffectedFixed
pyo3
crates.io
0.1.0 up to 0.24.1
0.24.1
pyo3
crates.io
0.0.0-0 up to 0.24.1
0.24.1

History

History
RecordedChangedSources
first indexedGitHub Advisories, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

GHSA-pph8-gcv7-4qj5 is a low vulnerability (CVSS 2.9) in pyo3, published April 1, 2025. No source lists public exploit code. Fixed in pyo3 0.24.1.

References

MoveEnter Open