# CVE-2026-2297: SourcelessFileLoader does not use io.open_code()

> Attackers can bypass sys.audit security monitoring when loading legacy .pyc files because the loader fails to trigger the required audit event.

- **Severity:** Medium 5.7 (`CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 4 Mar 2026
- **Updated:** 13 Aug 2026
- **Also known as:** ALPINE-CVE-2026-2297, AZL-79413, AZL-79457, AZL-79491, BELL-CVE-2026-2297, DEBIAN-CVE-2026-2297, ECHO-1808-4c87-682f, GHSA-86jh-grmm-2v3h, MINI-84x5-v9mj-62q4, MINI-94hc-h99r-hm9j, MINI-crwg-5qhf-pfcr, MINI-jqmp-hpqx-9675, MINI-m865-fc4p-9p2g, PSF-2026-9, SUSE-SU-2026:0971-1, UBUNTU-CVE-2026-2297, openSUSE-SU-2026:10377-1, openSUSE-SU-2026:10381-1, openSUSE-SU-2026:10394-1, openSUSE-SU-2026:10405-1

## What is CVE-2026-2297?

CVE-2026-2297 is a medium-severity vulnerability in CPython, published on 4 Mar 2026. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

The import hook in CPython that handles legacy *.pyc files (SourcelessFileLoader) is incorrectly handled in FileLoader (a base class) and so does not use io.open_code() to read the .pyc files. sys.audit handlers for this audit event therefore do not fire.

Weakness: CWE-668 (Exposure of Resource to Wrong Sphere)

## Which versions are affected by CVE-2026-2297?


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `python39` | openSUSE:Leap 15.6 | All versions | 3.9.25-150300.4.96.1 |
| `python39-core` | openSUSE:Leap 15.6 | All versions | 3.9.25-150300.4.96.1 |
| `python39-documentation` | openSUSE:Leap 15.6 | All versions | 3.9.25-150300.4.96.1 |
| `python311` | openSUSE:Tumbleweed | All versions | 3.11.15-2.1 |
| `python312` | openSUSE:Tumbleweed | All versions | 3.12.13-2.1 |
| `python313` | openSUSE:Tumbleweed | All versions | 3.13.12-2.1 |
| `python314` | openSUSE:Tumbleweed | All versions | 3.14.3-3.1 |

## How do I fix CVE-2026-2297?

Apply the vendor's patch.

## Is CVE-2026-2297 being exploited?

There is no known exploitation of CVE-2026-2297 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-2297 and fix it if it is affected.

What it is: CVE-2026-2297 is a medium-severity vulnerability in CPython, published on 4 Mar 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-2297 in the wild and no public exploit code.

Affected product: CPython. No package-level version data is available, so check the vendor advisory linked from the reference page.

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/CVE-2026-2297/ (Markdown: https://insights.sbomify.com/CVE-2026-2297/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-2297
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-2297
- OSV: https://osv.dev/vulnerability/CVE-2026-2297

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-2297/
Summaries are generated and may contain mistakes; the official description above is the record.
