GHSA-GPH2-38GW-42HR
cdx-verify and cdx-validate accept unsigned or altered BOM content as verified
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:L/SC:N/SI:L/SA:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-GPH2-38GW-42HR divulgada · CVSS 8.3 (GitHub) | |
| Remediación | Parche 12.8.6 | @cyclonedx/cdxgen · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The JSF signature verification in `cdx-verify`, `cdx-validate`, and the `verifyBom()` library function could report success for a CycloneDX BOM whose content was never signed by the trusted key. An attacker who can modify a signed BOM (in a registry, in transit, or in a pull request that CI verifies) could add or replace components, or present signatures taken from other documents, without the signer's private key. Verification cost could also be driven up by orders of magnitude with a few kilobytes of extra signature entries.
Details
- Root signature stripping (cdx-verify, 12.2.0+). When a BOM had no root `signature` but its components, services, or annotations carried signatures, `cdx-verify` verified only those nested signatures, ignored every unsigned element, and exited 0 ("✓ N nested signature(s) are valid!"). Removing the root signature of any BOM signed with nested signatures (the default for `cdx-sign` and `cdxgen` signing) and adding unsigned components therefore passed verification. Signed components could also be copied from any BOM the key had signed into an otherwise unsigned document.
- Trust anchor read from the working directory (cdx-verify, 9.5.0+). Without `--public-key`, `cdx-verify` used `public.key` from the current directory. A CI job that runs `cdx-verify` inside a checked-out pull request verified the attacker's BOM with the attacker's key.
- Nested signature presented as a BOM signature (12.2.0+). A component, service, or annotation signature covers `{...object, signature}` — the same shape as a root signature. When a signer signed a submitted BOM whose component was itself shaped like a BOM (`bomFormat`, `specVersion`, `components`), the component could be extracted and verified as a standalone BOM signed by that key.
- Ambiguous JSON (12.2.0+). The signed bytes are the RFC 8785 canonical form of the parsed document. `JSON.parse` keeps the last of repeated member names and rounds numbers to IEEE 754 doubles, and the file was decoded leniently, so text such as `{"components":[evil], …signed BOM…}`, `"version": 9007199254740993`, `1e999` (which canonicalizes like `null`), or a signed U+FFFD replaced by an invalid byte verified while parsers that keep the first member, use arbitrary-precision numbers, or decode UTF-8 strictly read different values.
- Unverifiable entries accepted silently (12.2.0+). For `signers` and `chain` signatures, verification succeeded when any one entry verified. Entries that no key verified (for example a fabricated "security-team" approval) were neither reported nor rejectable, and removing a co-signer's entry or the last entries of a chain could not be detected.
- cdx-validate failed open (12.2.0+). `cdx-validate --public-key` without `--require-signature` exited with the same code for a tampered BOM as for a valid one, and an empty key path or key file skipped verification.
- Verification cost amplification (12.2.0+). The whole BOM was canonicalized again for every signature entry, candidate form, and key, with no bound on the number of entries. 800 bogus `signers` entries (about 30 KB) took a 3.4 MB BOM from 0.24 s to 16 s; `chain` entries grew quadratically.
- Hardening in the same release: `cdx-sign --mode signers` co-signed content without checking that it still matched the existing signatures; RSA and ECDSA signatures did not commit to the signer's key unless one was embedded; ECDSA signatures were emitted in either `s` form.
Patches
Fixed in `@cdxgen/cdxgen` 13.4.0 and `@cyclonedx/cdxgen` 12.8.6:
- `cdx-verify` requires `--public-key` or `--secret-key` and never reads a key from the working directory. `--public-key` is repeatable.
- A root signature is required. `--allow-nested-only` accepts a BOM without one only when every component, service, and annotation carries a signature that verifies, and names the members no signature covers.
- A signed root must carry `bomFormat` (or `specFormat`) and `specVersion` and only CycloneDX root members, and signed nested elements may not carry `bomFormat`, `specFormat`, or `specVersion`; `cdx-sign` refuses to produce either shape.
- BOMs that are not UTF-8, repeat a member name, hold a number an IEEE 754 double cannot represent exactly, or hold an unpaired surrogate escape are refused by `cdx-verify`, `cdx-sign`, and `cdx-validate` (when a key is given), including BOMs pulled from OCI registries.
- Every root and nested `signers`/`chain` entry is reported. `--require-all` requires each entry to verify with one of the keys and each key to verify an entry of the root signature, so removed co-signatures and truncated chains fail.
- `cdx-validate` exits 4 whenever a key is given and verification fails (`--no-require-signature` restores report-only behaviour); an empty key path or key file is an error.
- At most 32 entries per signature and no members beside the `signers` or `chain` array; each signed object is canonicalized once and verification memory stays proportional to the document size.
- `cdx-sign` embeds the signer's public key in the root signature by default, writes low-`s` ECDSA signatures, and requires `--verify-existing-with` (or `--allow-unverified-history`) before appending a `signers` entry.
The signature format is unchanged: BOMs signed by 13.3.0 and 12.8.5 keep verifying.
Workarounds
- Always pass `--public-key` with a key from a trusted location.
- Treat a `cdx-verify` success without the line "✓ Signature is valid!" as a failure, and reject BOMs without a root `signature`.
- Pass `--require-signature` to `cdx-validate`.
- Reject BOM text with repeated member names or invalid UTF-8 before verifying it.
Residual risk
A signature that an affected `cdx-sign` made over an untrusted nested element carrying `bomFormat` and `specVersion` can still be presented as a BOM signature, because the bytes are identical. Re-sign BOMs whose nested elements came from untrusted input. Removed signature entries are only detected with `--require-all` and the key of every expected signer. With `--allow-nested-only`, nothing protects which signed elements a BOM lists.
Credits
Found during an internal review of the JSF implementation prompted by Erin Shepherd's post on signature verification (https://blog.erincandescent.net/2026/10/mu-annoys-me/).
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.8.6 | 0 d | 12.9.2 no afectada |
12.8.613.4.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-gph2-38gw-42hrLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
