GitHub Advisoryadvisory · crates.io
GHSA-6jgw-rgmm-7cv6 PyO3 has a risk of use-after-free in `borrowed` reads from Python weak references
MEDIUM
Official page ↗
- Aliases
- CVE-2024-9979
- Ecosystem
- crates.io
- Packages
- pyo3
- Severity
- Moderate
- CVSS vector
- CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
- Weaknesses
- CWE-416
- Reviewed
- 2024-10-15
Affected packages
• crates.io pyo3: >= 0.22.0, < 0.22.4 → fixed in 0.22.4
Description
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.
Related
Alias · CVE (1)
- CVE-2024-9979 A flaw was found in PyO3. vulnerability
Weakness · CWE (1)
- CWE-416 Use After Free weakness
References
- https://nvd.nist.gov/vuln/detail/CVE-2024-9979 advisory
- https://github.com/PyO3/pyo3/pull/4590 web
- https://access.redhat.com/security/cve/CVE-2024-9979 web
- https://bugzilla.redhat.com/show_bug.cgi?id=2318646 web
- https://crates.io/crates/pyo3 web
- https://github.com/PyO3/pyo3 package
- https://rustsec.org/advisories/RUSTSEC-2024-0378.html web