PyO3 has an Out-of-bounds Read in `nth` / `nth_back` for `PyList` and `PyTuple` iterators
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
PyO3 0.24.0 added optimized implementations of `Iterator::nth` and `DoubleEndedIterator::nth_back` for the `BoundListIterator` and `BoundTupleIterator` types. These implementations computed the target index using unchecked `usize` addition (`index + n`) before bounds-checking against the sequence length, then read the element via `get_item_unchecked`. In `nth` methods, a sufficiently large `n` (combined with a non-zero internal index) could cause the addition to overflow and wrap around, producing a small "target index" that passed the bounds check and enabling reads at the front of the `list` or `tuple` of elements previously yielded by the iterator. In `nth_back` methods, a sufficiently large `n` could cause underflow in a similar fashion, however would instead allow reads of arbitrary memory past the end of the `list` or `tuple` storage.
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) | before 0.29.0 | 0.29.0 | Patch available | GHSA-36hh-v3qg-5jq4 |
- pyo3 (crates.io) Vendor— Affected before 0.29.0 Fixed in 0.29.0 Patch available GHSA-36hh-v3qg-5jq4
Remediation
- Fix · GHSA-36hh-v3qg-5jq4 pyo3 (crates.io) Fixed in 0.29.0 Advisory →
Timeline
- 2026-10-03 Threatist record created from GHSA-36hh-v3qg-5jq4
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences