Skip to content

GHSA-2vx6-fcw6-hpr6 CVE-2020-35917 RUSTSEC-2020-0074

Reference counting error in pyo3

Medium crates.io
Severity
5.5 / 10
Medium · CVSS 3.1
Exploit chance (EPSS)
0.39%
Chance of exploitation in the next 30 days. Higher than 33.48% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-416 Use After Free
Fix
0.12.4
Upgrade pyo3 to this version or later

Description

An issue was discovered in the pyo3 crate before 0.12.4 for Rust. There is a reference-counting error and use-after-free in From<Py<T>>.

Affected versions

crates.io

PackageVulnerableFixed in
pyo3
>= 0.12.0, < 0.12.4
0.12.4

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

pyo3 crates.io → 0.12.4

cargo
cargo update -p pyo3 --precise 0.12.4

Severity breakdown

CVSS 3.1 5.5

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

Attack vector
Local
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

Weakness

CWE-416: Use After Free

The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.

How to prevent it
  • Architecture and Design: Choose a language that provides automatic memory management.
  • Implementation: When freeing pointers, be sure to set them to NULL once they are freed. However, the utilization of multiple or complex data structures may lower the usefulness of this strategy.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-chgr-c6px-7xpp
PyO3 has a missing `Sync` bound on `PyCFunction::new_closure` closures
Medium Also affects pyo3
GHSA-36hh-v3qg-5jq4
PyO3 has an Out-of-bounds Read in `nth` / `nth_back` for `PyList` and `PyTuple` iterators
High Also affects pyo3
GHSA-47qc-857f-7w7f
PyO3 has type confusion when accessing data from sublasses of subclasses of native types with `abi3` feature
High Also affects pyo3
GHSA-pph8-gcv7-4qj5
PyO3 Risk of buffer overflow in `PyString::from_object`
Low Also affects pyo3
GHSA-vxcf-c7mx-pg53
Build corruption when using `PYO3_CONFIG_FILE` environment variable
Medium Also affects pyo3
GHSA-6jgw-rgmm-7cv6
PyO3 has a risk of use-after-free in `borrowed` reads from Python weak references
Medium Also affects pyo3
CVE-2026-109619
PHP has various global state that temporarily points into request memory.
Critical Known exploited Same weakness, CWE-416
CVE-2026-109618
PHP uses longjmp() for out-of-memory (OOM) errors to exit the current context and abort handling of the request.
Critical Known exploited Same weakness, CWE-416
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor