GHSA-P8WX-9PX6-7RMP
Prototype pollution from Meson wrap files lets a scanned repository run commands
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-P8WX-9PX6-7RMP divulgada · CVSS 9.8 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
A `[__proto__]` section in a Meson wrap file (`subprojects/*.wrap`) of a scanned tree writes its `key = value` lines onto `Object.prototype` in the cdxgen process. The inherited properties then become environment variables of the child processes that cdxgen starts, and they fill in cdxgen settings that are read from unset environment variables. The author of a scanned repository, source archive or container image can use this to have a program of their choice run with the privileges and environment of cdxgen. This works with `--no-install-deps` and `--lifecycle pre-build`, needs no build tool, and does not require the operator to select a C/C++ scan.
Details
`readMesonWraps()` in `lib/ecosystems/parsers-misc.js` keeps the sections of a wrap file in plain objects (`sections[section] = sections[section] || {}`). For a section named `__proto__`, `sections[section]` is `Object.prototype`, so every following line of that section is written onto it. The parser runs for each `meson.build` that the C/C++ step finds (`createCppBom()` calls `parseCmakeLikeFile()`, which reads the wraps first). That step also runs in scans without `-t`. It only reads files, so no install setting skips it.
Two things carry the polluted prototype out of the process:
- Node.js copies inherited properties of a spawn's `env` object into the child's environment. cdxgen builds such objects as `{ ...process.env, ... }`, for example in `hardenedGitEnv()`, and those objects inherit from `Object.prototype`.
- `readEnvironmentVariable()` returns `process.env[name]`, which falls through to the prototype for a variable the operator has not set, such as `PYTHON_CMD`, `ATOM_CMD` or `POD_CMD`.
Several variables turn this into command execution: `GIT_EXEC_PATH` makes the same scan's `git submodule status` start a helper program from the repository (with a git whose `submodule` command is an external program); `PYTHON_CMD` replaces the interpreter of the formulation probe (formulation is on with `--include-formulation`, and by default under `CI=true` from 13.7.0); `NODE_OPTIONS` and `ATOM_CMD` affect the atom step of C/C++ scans; and `LD_PRELOAD` loads a shared library from the repository into git. The scan that triggers the pollution later fails BOM schema validation, but by then the child process has run.
Impact
Code execution as the user running cdxgen, with that user's environment (CI tokens, registry credentials), from files committed to a scanned tree. This affects command-line and CI scans of untrusted repositories, pull requests and archives, including scans with `--no-install-deps`. `CDXGEN_SECURE_MODE=true` skips some of the routes, but the `LD_PRELOAD` route still loads native code into an allowlisted `git`, and `ATOM_CMD` can name an allowlisted interpreter such as `node`, because the command allowlist compares command names only.
In `cdxgen --server` mode, an unauthenticated client can trigger this by asking the server to scan a git URL it controls. The prototype stays polluted until the process exits, so every later request of every client runs with the injected values. `--dry-run` starts no processes and is not affected.
Patches
Fixed in `@cdxgen/cdxgen` 13.8.0. Versions 13.6.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
- Scan untrusted trees in a disposable container or VM that holds no credentials.
- Pass an explicit `-t` that does not include the C/C++ types (`c`, `cpp`, `meson` and their aliases), so that wrap files are not read.
- In server mode, restrict who can reach the server, restrict git hosts with `CDXGEN_SERVER_ALLOWED_HOSTS`, and restart the process after any scan of a tree that contains `subprojects/*.wrap`.
Credit
This issue was found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-XJCCU1MK.
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-p8wx-9px6-7rmpLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
