CVE-2026-42301 Improper Input Validation leading to Improper Control of Generation of Code ('Code Injection') in pyp2spec
Attackers can execute arbitrary commands on build machines by injecting RPM macros into PyPI metadata processed by pyp2spec.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2026-42301?
CVE-2026-42301 is a high-severity code injection vulnerability in befeleme pyp2spec, published on 9 May 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Official description
pyp2spec generates working Fedora RPM spec file for Python projects. Prior to version 0.14.1, pyp2spec was writing PyPI package metadata (e.g. the summary field) into the generated spec file without escaping RPM macro directives. When a packager then runs rpmbuild, those directives get evaluated, so a malicious package can execute arbitrary commands on the build machine. This issue has been patched in version 0.14.1.
Which versions are affected by CVE-2026-42301?
3 open source packages ship an affected version, including pyp2spec.
| Package | Affected | Fixed in |
|---|---|---|
pyp2spec PyPI | All versions | 0.14.1 |
pyp2spec PyPI | All versions | 0.14.1 |
pyp2spec PyPI | All versions | 0.14.1 |
How do I fix CVE-2026-42301?
Upgrade pyp2spec to 0.14.1 or later.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2026-42301 being exploited?
There is no known exploitation of CVE-2026-42301 in the wild and no public exploit code.
Sources
Also known as GHSA-r35x-v8p8-xvhw, PYSEC-2026-3003.