GHSA-47qc-857f-7w7f: Pyo3 PyO3 Has Type Confusion When Vulnerability

HIGH
CWE-843
Published
Advisory Summary

GHSA-47qc-857f-7w7f is a HIGH pyo3 has type confusion when vulnerability (CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')) affecting Pyo3 libraries in the crates.io ecosystem. The issue involves pyo3 has type confusion when accessing data from sublasses of subclasses of native types with `abi3` feature. Remediation is available by upgrading affected packages to version 0.28.2.

GHSA-47qc-857f-7w7f at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-47qc-857f-7w7f
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')
Affected Product Pyo3
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-47qc-857f-7w7f

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.

pyo3 fixed: 0.28.2
Upgrade pyo3 to 0.28.2
Verify Direct and Transitive Dependencies

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-47qc-857f-7w7f, 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.28.2), 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-843: Access of Resource Using Incompatible Type ('Type Confusion'), where the product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type. 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

PyO3 0.28.1 added support for `#[pyclass(extends=PyList)] struct NativeSub` (and other native types) when targeting Python 3.12 and up with the `abi3` feature. It was discovered that subclasses of such classes would use the type of the subclass when attempting to access to data of `NativeSub` contained within Python objects, amounting to memory corruption. PyO3 0.28.2 fixed the issue by using the type of (e.g.) `NativeSub` correctly.

GHSA-47qc-857f-7w7f Affected Pyo3 Versions

1 component(s)
Fixed Versions:
0.28.2
Product / Package Ecosystem Affected Versions Fixed Version
pyo3
crates.io
≥ 0.28.0
< 0.28.2
0.28.2

References

Frequently Asked Questions

What is GHSA-47qc-857f-7w7f?
GHSA-47qc-857f-7w7f is a security vulnerability in Pyo3 involving PyO3 has type confusion when accessing data from sublasses of subclasses of native types with `abi3` feature under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion').
Which Pyo3 versions are affected?
Affected versions include releases prior to 0.28.2 across affected packages: pyo3.
What version fixes GHSA-47qc-857f-7w7f?
Upgrading to 0.28.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pyo3 affected?
Yes, pyo3 is affected in releases prior to 0.28.2. Upgrade your dependency to 0.28.2 or later.
What CWE is associated with GHSA-47qc-857f-7w7f?
GHSA-47qc-857f-7w7f is classified under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion') (The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.).
How can I check crates.io dependencies for GHSA-47qc-857f-7w7f?
Run the dependency tree command: 'inspect dependencies for pyo3'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-47qc-857f-7w7f",
  "modified" : "2026-02-19T20:25:46Z",
  "published" : "2026-02-19T20:25:46Z",
  "aliases" : [ ],
  "summary" : "PyO3 has type confusion when accessing data from sublasses of subclasses of native types with `abi3` feature",
  "details" : "PyO3 0.28.1 added support for `#[pyclass(extends=PyList)] struct NativeSub` (and other native types) when targeting Python 3.12 and up with the `abi3` feature.\n\nIt was discovered that subclasses of such classes would use the type of the subclass when attempting to access to data of `NativeSub` contained within Python objects, amounting to memory corruption.\n\nPyO3 0.28.2 fixed the issue by using the type of (e.g.) `NativeSub` correctly.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "pyo3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.28.0"
      }, {
        "fixed" : "0.28.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/PyO3/pyo3/pull/5807#issuecomment-3913251784"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PyO3/pyo3/commit/75abd8602896b350fd8c778e52e0a74b4644ccca"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/PyO3/pyo3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PyO3/pyo3/releases/tag/v0.28.2"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2026-0013.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-843" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-02-19T20:25:46Z",
    "nvd_published_at" : null
  }
}