Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. pyp2spec
  4. ›
  5. CVE-2026-42301

CVE-2026-42301: pyp2spec is Vulnerable to Code Injection

May 4, 2026

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.

The macro evaluates during spec parsing, not only during the build step. Any rpm tool touching the generated spec triggers execution, rpmbuild -bs, rpmbuild --nobuild, rpm -q --specfile, so the victim doesn’t need to commit to a full build before getting compromised. The realistic attack path is typosquatting or targeting a package known to be under Fedora review rather than drive-by publishing. Fedora packagers hold dist-git SSH keys, Koji build credentials, and Bodhi update credentials, so compromise of one packager’s workstation enables committing malicious source to dist-git and riding it through the normal build pipeline to end users.

References

  • github.com/advisories/GHSA-r35x-v8p8-xvhw
  • github.com/befeleme/pyp2spec
  • github.com/befeleme/pyp2spec/security/advisories/GHSA-r35x-v8p8-xvhw
  • nvd.nist.gov/vuln/detail/CVE-2026-42301

Code Behaviors & Features

Detect and mitigate CVE-2026-42301 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 0.14.1

Fixed versions

  • 0.14.1

Solution

Upgrade to version 0.14.1 or above.

Impact 7.8 HIGH

CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-20: Improper Input Validation
  • CWE-94: Improper Control of Generation of Code ('Code Injection')

Source file

pypi/pyp2spec/CVE-2026-42301.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 09 May 2026 12:20:27 +0000.