# GHSA-47qc-857f-7w7f: 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.

> Type confusion in PyO3 with abi3 feature allows memory corruption, potentially leading to code execution or crashes.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Not stated
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 18 Feb 2026
- **Also known as:** RUSTSEC-2026-0013

## What is GHSA-47qc-857f-7w7f?

GHSA-47qc-857f-7w7f is a memory corruption vulnerability in pyo3, published on 18 Feb 2026. 

### Official description

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.

## Which versions are affected by GHSA-47qc-857f-7w7f?

3 open source packages ship an affected version, including pyo3.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `pyo3` | crates.io | From 0.28.0 | 0.28.2 |
| `pyo3` | crates.io | From 0.28.0 | 0.28.2 |
| `pyo3` | crates.io | From 0.28.0 | 0.28.2 |

## How do I fix GHSA-47qc-857f-7w7f?

Upgrade pyo3 to 0.28.2 or later.

## Is GHSA-47qc-857f-7w7f being exploited?

There is no known exploitation of GHSA-47qc-857f-7w7f in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-47qc-857f-7w7f and fix it if it is affected.

What it is: GHSA-47qc-857f-7w7f is a memory corruption vulnerability in pyo3, published on 18 Feb 2026. 
Exploitation: There is no known exploitation of GHSA-47qc-857f-7w7f in the wild and no public exploit code.

Affected packages and fixed versions:
- pyo3 (crates.io): affected from 0.28.0; fixed in 0.28.2
- pyo3 (crates.io): affected from 0.28.0; fixed in 0.28.2
- pyo3 (crates.io): affected from 0.28.0; fixed in 0.28.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-47qc-857f-7w7f/ (Markdown: https://insights.sbomify.com/GHSA-47qc-857f-7w7f/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-47qc-857f-7w7f

---
From sbomify Insights: https://insights.sbomify.com/GHSA-47qc-857f-7w7f/
Summaries are generated and may contain mistakes; the official description above is the record.
