GHSA-36hh-v3qg-5jq4 json
PyO3 has an Out-of-bounds Read in `nth` / `nth_back` for `PyList` and `PyTuple` iterators
published 5mo ago modified 2mo ago also RUSTSEC-2026-0176
- cvss
- —
- not scored
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- —
- no score, EPSS covers CVEs only
- public exploits
- 0
- none known
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.
Patch / fix
Is GHSA-36hh-v3qg-5jq4 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerAffected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| crates.io | pyo3 | <0.29.0 >=0.24.0, <0.29.0 |
0.29.0 |
Classification
- Weakness
-
- CWE-125 Out-of-bounds Read
References
-
github.com
/PyO3/pyo3/pull/6086
web
-
github.com
/PyO3/pyo3
package
-
rustsec.org
/advisories/RUSTSEC-2026-0176.html
web, advisory
-
crates.io
/crates/pyo3
package
Sources
- GitHub Advisory GHSA-36hh-v3qg-5jq4
- OSV RUSTSEC-2026-0176
Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.