GHSA-C6Q7-GWW9-HR98
Network-path URLs keep their credentials in BOM text such as recorded CI commands
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-C6Q7-GWW9-HR98 divulgada · CVSS 2.3 (GitHub) | |
| Remediación | Parche 12.9.2 | @cyclonedx/cdxgen · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
cdxgen removes the userinfo, query string and fragment of URLs in text it copies into a BOM, such as the commands of CI workflow steps. The fix that makes it do so in 13.8.0 (GHSA-4cc7-jx94-rr7r) recognised only URLs written as `scheme://`. A network-path reference without a scheme (RFC 3986 section 4.2), such as `//user:password@host/path`, kept its credentials. The gap was found and reported before 13.8.0 was released, and 13.8.0 contains the fix for both forms.
Details
`stripUrlCredentials()` in `lib/core/propertySanitizer.js` looked for `://` and returned any text without it unchanged. It is the function behind `sanitizeBomText()` and `sanitizeBomPropertyValue()`, so every component property and every formulation command went through it. `sanitizeBomUrl()` and `sanitizeBomReferenceUrl()` did not treat a value starting with `//` as a URL either.
A GitHub Actions workflow with this step shows the effect when the repository is scanned with formulation, which cdxgen collects by default in CI (`CI=true`), with `--bom-audit`, and with `--include-formulation`:
- run: npm publish --registry=//deploy:s3cr3t@pkgs.internal/npm/The password appeared in the component property `cdx:github:step:command` and in `formulation[].workflows[].tasks[].steps[].commands[].executed`. The same step written with `https://deploy:s3cr3t@pkgs.internal/npm/` was redacted.
Releases before 13.8.0 record these commands without removing the credentials of any URL, whatever its form. That is GHSA-4cc7-jx94-rr7r, and the ranges below are the same releases of the 12.x and 13.x lines that record step commands. This advisory records that the network-path form needed its own handling and credits the report.
Impact
A credential written literally into a committed CI file, in the network-path form, is copied into the BOM, so anyone who receives the BOM can read it even if they cannot read the repository. Most tools do not accept a registry or index URL without a scheme, so such lines are uncommon, and credentials that are passed through CI secrets or variables, as in `${{ secrets.TOKEN }}`, are not affected.
Patches
Fixed in `@cdxgen/cdxgen` 13.8.0 by commit a559f449a187402311d9ec926244540fe27fc539 (#4790). Two slashes are now read as the start of a URL when they begin the text or follow white space, `=`, a quote, `(`, `,` or `<`, and the userinfo before `@` holds a `:`. Comments such as `// see user@example.com`, regular expressions and a bare `//name@host` are left as written. A value that is a whole network-path reference loses its userinfo, query and fragment in `sanitizeBomUrl()` and `sanitizeBomReferenceUrl()`, also when the userinfo has no `:`. The scan stays linear in the length of the text.
The 12.x line, published as `@cyclonedx/cdxgen`, gets no fix. Users of 12.x should move to `@cdxgen/cdxgen` 13.8.0.
Workarounds
- Keep credentials out of committed CI files and pass them through the CI system's secrets.
- Pass `--no-include-formulation` when the BOM is shared outside the team that owns the repository.
- Review the formulation section of a BOM before sharing it.
References
- https://github.com/cdxgen/cdxgen/pull/4790
- https://github.com/cdxgen/cdxgen/commit/a559f449a187402311d9ec926244540fe27fc539
- https://github.com/cdxgen/cdxgen/security/advisories/GHSA-4cc7-jx94-rr7r
- https://www.rfc-editor.org/rfc/rfc3986#section-4.2
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npm@cyclonedx/cdxgen |
Corregida | 12.9.2 | 0 d | 12.9.2 no afectada |
12.9.213.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-c6q7-gww9-hr98Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
