GHSA-chgr-c6px-7xpp: Pyo3 :new_closure` Closures Vulnerability
MODERATEGHSA-chgr-c6px-7xpp is a MODERATE :new_closure` closures vulnerability (CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')) affecting Pyo3 libraries in the crates.io ecosystem. The issue involves :new_closure` closures. Remediation is available by upgrading affected packages to version 0.29.0.
GHSA-chgr-c6px-7xpp at a Glance
How to Fix GHSA-chgr-c6px-7xpp
To remediate this vulnerability, upgrade all affected Pyo3 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade pyo3 to 0.29.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for pyo3
How to Check if You Are Affected
To determine whether your application is affected by GHSA-chgr-c6px-7xpp, inspect your project dependencies for Pyo3:
inspect dependencies for pyo3
Analyze the terminal output to locate any version of Pyo3 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.29.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition'), where the product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently. In Pyo3, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-chgr-c6px-7xpp Affected Pyo3 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pyo3
|
crates.io |
< 0.29.0
|
0.29.0
|
References
Frequently Asked Questions
What is GHSA-chgr-c6px-7xpp?
Which Pyo3 versions are affected?
What version fixes GHSA-chgr-c6px-7xpp?
Is pyo3 affected?
What CWE is associated with GHSA-chgr-c6px-7xpp?
How can I check crates.io dependencies for GHSA-chgr-c6px-7xpp?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-chgr-c6px-7xpp",
"modified" : "2026-06-12T20:09:05Z",
"published" : "2026-06-12T20:09:05Z",
"aliases" : [ ],
"summary" : "PyO3 has a missing `Sync` bound on `PyCFunction::new_closure` closures",
"details" : "`PyCFunction::new_closure` (and the temporary `new_closure_bound` complement in the 0.21–0.22 series) required the supplied closure to be `Send + 'static` but not `Sync`. The resulting `PyCFunction` is a Python callable that can be invoked from any Python thread, which means the closure may be called concurrently from multiple threads, and needs a `Sync` bound to prevent possible data races.\n\nThe problem exists under all Python versions but is particularly vulnerable under the newer free-threaded Python variant, which do not have serial execution imposed by the Global Interpreter Lock. Under releases protected by the GIL, the ability to \"detach\" from the Python interpreter temporarily inside the closure (e.g. by `Python::detach`) makes it possible for interleaved and/or concurrent execution of various portions of the closure.\n\nPyO3 0.29.0 added a `Sync` bound to close this thread-safety bug.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "pyo3"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.29.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/PyO3/pyo3/pull/6096"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/PyO3/pyo3"
}, {
"type" : "WEB",
"url" : "https://github.com/PyO3/pyo3/releases/tag/v0.29.0"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2026-0177.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-362" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-06-12T20:09:05Z",
"nvd_published_at" : null
}
}