Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. pyo3
  4. ›
  5. CVE-2024-9979

CVE-2024-9979: PyO3 has a risk of use-after-free in `borrowed` reads from Python weak references

October 15, 2024

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.

References

  • access.redhat.com/security/cve/CVE-2024-9979
  • bugzilla.redhat.com/show_bug.cgi?id=2318646
  • crates.io/crates/pyo3
  • github.com/PyO3/pyo3
  • github.com/PyO3/pyo3/pull/4590
  • github.com/advisories/GHSA-6jgw-rgmm-7cv6
  • nvd.nist.gov/vuln/detail/CVE-2024-9979
  • rustsec.org/advisories/RUSTSEC-2024-0378.html

Code Behaviors & Features

Detect and mitigate CVE-2024-9979 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 0.22.0 before 0.22.4

Fixed versions

  • 0.22.4

Solution

Upgrade to version 0.22.4 or above.

Impact 5.3 MEDIUM

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L

Learn more about CVSS

Weakness

  • CWE-416: Use After Free

Source file

cargo/pyo3/CVE-2024-9979.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:15:12 +0000.