Miggo Logo

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

5.3

CVSS Score
3.1

Basic Information

EPSS Score
0.25705%
Published
10/15/2024
Updated
10/15/2024
KEV Status
No
Technology
TechnologyRust

Technical Details

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
Package NameEcosystemVulnerable VersionsFirst Patched Version
pyo3rust>= 0.22.0, < 0.22.40.22.4

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

  1. The RustSec advisory explicitly lists these functions under 'Affected Functions' with vulnerable version ranges.
  2. The GHSA description specifies that 'borrowed' read methods from weak references are unsound.
  3. The PR #4590 shows these methods were patched to leak references instead of borrowing.
  4. All functions follow the pattern of returning borrowed references from weakrefs without ownership, violating Rust's safety guarantees when underlying Python objects might be collected.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

T** **mily o* *un*tions to r*** "*orrow**" v*lu*s *rom Pyt*on w**k r***r*n**s w*r* *un**m*nt*lly unsoun*, ****us* t** w**k r***r*n** *o*s its*l* not **v* own*rs*ip o* t** v*lu*. *t *ny point t** l*st stron* r***r*n** *oul* ** *l**r** *n* t** *orrow**

Reasoning

*. T** RustS** **visory *xpli*itly lists t**s* *un*tions un**r '*****t** *un*tions' wit* vuln*r**l* v*rsion r*n**s. *. T** **S* **s*ription sp**i*i*s t**t '*orrow**' r*** m*t*o*s *rom w**k r***r*n**s *r* unsoun*. *. T** PR #**** s*ows t**s* m*t*o*s w