Package names from scanned Python metadata reach pip install as options
Description
When the safe-pip-install step is on, getPipTreeForPackages() passes a package name and version read from the scanned tree to python -m pip install as the last argument, without -- and without checking that it looks like a distribution name and version. A crafted name can make pip read a requirements file chosen by the tree's author, build a local directory from the tree (running its build code), or write its log to an arbitrary path. The step is opt-in, but SAFE_PIP_INSTALL=true is set in the Python container images.
Details
For each component that createPythonBom() collected, getPipTreeForPackages() in lib/ecosystems/pythonutils.js appends <name>==<version> (or the name with cdx:pypi:versionSpecifiers) to python -m pip install, with the scanned directory as the working directory. The values are copied from site-packages/**/METADATA, wheel METADATA, Pipfile.lock and poetry.lock. They also come from requirements.txt, where parseReqData() tests for a leading dash before it removes backslashes, so an escaped option survives. A distribution named like a pip option becomes that option, and path-shaped or archive-shaped values make pip build or install from the tree.
Impact
Installs on (the default outside secure mode) already let a tree author run code through an ordinary requirements file. What this adds is narrower: someone who controls only a package name, such as a vendored wheel or a METADATA file, gets code executed even when the operator has restricted pip to binary distributions, and can make pip write files outside the tree. Secure mode is not affected.
Patches
Fixed in @cdxgen/cdxgen 13.8.0. Versions 13.0.0 through 13.7.0 of @cdxgen/cdxgen are affected. The 12.x line, published as @cyclonedx/cdxgen, is also affected from 10.9.0 through 12.9.1, and no 12.x release contains the fix. Users of 12.x should move to @cdxgen/cdxgen 13.8.0 or apply the workarounds below. File paths in this advisory refer to the 13.x source tree; in 12.x most of the same functions are under lib/helpers/ or in lib/cli/index.js.
Workarounds
- Leave
SAFE_PIP_INSTALLunset, or set it tofalse, when scanning untrusted Python projects. - Use
--no-install-depsor secure mode for untrusted projects.
Credit
This issue was found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-EIGVXVC6.