CVE-2024-9979
Rust vulnerability analysis and mitigation

Overview

A vulnerability (CVE-2024-9979) was discovered in PyO3, affecting versions 0.22.0 to 0.22.3. The flaw relates to unsound borrowing from weak Python references, which could potentially lead to memory corruption or crashes. The vulnerability was disclosed on October 15, 2024 (NVD, RustSec).

Technical details

The vulnerability stems from functions that read 'borrowed' values from Python weak references. The fundamental issue is that weak references do not maintain ownership of the referenced value, meaning the last strong reference could be cleared at any point, resulting in a dangling reference. The vulnerability has been assigned a CVSS v3.1 base score of 5.3 (Medium) with the vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L and is classified as CWE-416 (Use After Free) (NVD).

Impact

If exploited, this vulnerability could lead to memory corruption or application crashes due to use-after-free conditions when accessing Python weak references. The issue specifically affects scenarios where borrowed values are read from weak references, potentially compromising the stability and security of applications using affected PyO3 versions (RustSec).

Mitigation and workarounds

The issue has been addressed in PyO3 version 0.22.4, where the affected functions have been deprecated and patched to leak a strong reference as a temporary mitigation. The functions will be completely removed in PyO3 0.23. Users are strongly advised to upgrade to version 0.22.4 or later and move away from using the deprecated borrowed reference methods (RustSec, GitHub PR).

Community reactions

The security community has noted concerns about the mitigation strategy. While leaking references is considered the lesser evil compared to use-after-free vulnerabilities, it has been pointed out that Python's reference counts lack overflow checking, which could potentially lead to other security issues, particularly on 32-bit platforms (GitHub PR).

Additional resources


SourceThis report was generated using AI

Related Rust vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-66627HIGH8.4
  • RustRust
  • wasmi
NoYesDec 09, 2025
GHSA-xrv8-2pf5-f3q7MEDIUM6
  • RustRust
  • nitro-tpm-pcr-compute
NoYesDec 05, 2025
CVE-2025-67487MEDIUM5.5
  • RustRust
  • static-web-server
NoYesDec 09, 2025
CVE-2025-66622LOW1.3
  • RustRust
  • matrix-sdk-base
NoYesDec 09, 2025
RUSTSEC-2025-0135N/AN/A
  • RustRust
  • matrix-sdk-base
NoYesDec 08, 2025

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management