GHSA-4P2J-75XR-7VC4
C/C++ scans run a compiler that the scanned repository names in compile_commands.json
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-4P2J-75XR-7VC4 divulgada · CVSS 8.8 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
To identify the compilers of a C/C++ project, cdxgen runs each compiler driver named in the project's `compile_commands.json` with `--version`. The check that is meant to keep this to real toolchains, `trustedCompilerPath()`, only refuses paths spelled inside the scan root. A database can therefore name a program shipped in the same checkout, and cdxgen runs it. This happens in `-t c`, `-t cpp` and untyped scans, which otherwise start no project build tool, and it still happens with `--no-install-deps` and `--lifecycle pre-build`.
Details
`trustedCompilerPath()` in `lib/ecosystems/cppBuildContext.js` accepts every absolute path unless `isInsideDir()` places it under the scan root. A file from the same checkout passes this check in three cases:
- The operator scans a subdirectory of the checkout, and the database names a file elsewhere in it.
- The path goes through a directory whose name starts with `..`. `isInsideDir()` tests `rel.startsWith("..")`, so such a directory counts as outside even in a scan of the whole checkout.
- The database spells the scan root in a different letter case on a case-insensitive file system.
The database must give an absolute path. A repository can do this when cdxgen is started inside the checkout (on Linux, through `/proc/self/cwd`) or when the checkout sits at a predictable location such as a CI workspace. `queryCompilerBanner()` then starts the file through `safeSpawnSync()`, and its output is recorded in the BOM as the compiler version.
Impact
The author of a repository, or of a pull request to it, gets code of their choice run on the scanning host with the privileges and environment of the cdxgen process, including any CI tokens or registry credentials. Secure mode, `--dry-run` and a `CDXGEN_ALLOWED_COMMANDS` list that does not include the file are not affected. A repository that `cdxgen --server` clones into a random temporary directory is not reachable, because the database cannot name its path.
Patches
Fixed in `@cdxgen/cdxgen` 13.8.0. Versions 13.4.0 through 13.7.0 of `@cdxgen/cdxgen` are affected. The 12.x line, published as `@cyclonedx/cdxgen`, does not contain the affected code.
Workarounds
- Use `CDXGEN_SECURE_MODE=true`, or set `CDXGEN_ALLOWED_COMMANDS` to the tools the scan needs.
- Scan untrusted repositories from outside the checkout, by path, and scan the whole checkout rather than a subdirectory.
- Delete `compile_commands.json` files from untrusted checkouts before scanning.
Credit
This issue was found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-3FMLUTQ4.
References
- https://github.com/cdxgen/cdxgen/blob/master/SECURITY.md
- https://github.com/cdxgen/cdxgen/blob/master/docs/THREAT_MODEL.md
- Fixed in: https://github.com/cdxgen/cdxgen/pull/4787
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npm@cdxgen/cdxgen |
Corregida | 13.8.0 | — | — |
13.8.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/cdxgen/cdxgen/security/advisories/GHSA-4p2j-75xr-7vc4Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
