Skip to content

GHSA-vxcf-c7mx-pg53 RUSTSEC-2024-0409

Build corruption when using `PYO3_CONFIG_FILE` environment variable

Medium crates.io
Severity
Medium
The publisher's own rating, not a CVSS score
Exploit chance (EPSS)
—
No score published
Known exploited
No
Not in CISA's catalog
Weakness
—
Not classified
Fix
0.23.3
Upgrade pyo3 to this version or later

Description

In PyO3 0.23.0 the PYO3_CONFIG_FILE environment variable used to configure builds regressed such that changing the environment variable would no longer trigger PyO3 to reconfigure and recompile. In combination with workflows using tools such as maturin to build for multiple versions in a single build, this leads to Python wheels being compiled against the wrong Python API version.

All users who distribute artefacts for multiple Python versions are encouraged to update and rebuild with PyO3 0.23.3. Affected wheels produced from PyO3 0.23.0 through 0.23.2 are highly unstable and will crash the Python interpreter in unpredictable ways.

Affected versions

crates.io

PackageVulnerableFixed in
pyo3
>= 0.23.0, < 0.23.3
0.23.3

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.23.3

cargo
cargo update -p pyo3 --precise 0.23.3

References

Timeline

  1. Published
  2. Last updated by the source
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-6jgw-rgmm-7cv6
PyO3 has a risk of use-after-free in `borrowed` reads from Python weak references
Medium Also affects pyo3
GHSA-2vx6-fcw6-hpr6
Reference counting error in pyo3
Medium Also affects pyo3
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