Advisory

GHSA-6jgw-rgmm-7cv6

Also known as: CVE-2024-9979, RUSTSEC-2024-0378

Summary

PyO3 has a risk of use-after-free in borrowed reads from Python weak references

Details

The family of functions to read "borrowed" values from Python weak references were fundamentally unsound, because the weak reference does itself not have ownership of the value. At any point the last strong reference could be cleared and the borrowed value would become dangling.

In PyO3 0.22.4 these functions have all been deprecated and patched to leak a strong reference as a mitigation. PyO3 0.23 will remove these functions entirely.

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2024-10-15 15:30 UTC
Modified
2025-10-28 06:29 UTC

Affected packages and fixes

pyo3

crates.io · All systems

Affected

  • introduced 0.22.0, fixed 0.22.4 (semver)

Fixed versions

0.22.4

Fix

  • Fixed version 0.22.4
    cargo update -p pyo3 --precise 0.22.4

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences