GHSA-7M2V-PJ5R-FJWW
cdx-verify accepts forged BOM signatures that declare an HMAC algorithm
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:L/SA:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-7M2V-PJ5R-FJWW divulgada · CVSS 8.2 (GitHub) | |
| Remediación | Parche 12.8.5 | @cyclonedx/cdxgen · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Impact
`cdx-verify`, `cdx-validate --require-signature`, and the `verifyBom` and `verifyNode` library functions trusted the algorithm named inside a BOM's JSF signature block. When a signature declared `HS256`, `HS384` or `HS512`, the verifier computed an HMAC using the verification key it had been given as the shared secret. In the normal workflow that key is the signer's public key, which is published by design. Anyone holding the public key could therefore produce a signature that verifies for any BOM content they choose.
An attacker who can place a BOM in front of a verifier, for example by replacing the SBOM attached to an OCI image, tampering with an artifact store or mirror, or intercepting the BOM in transit, could have a modified BOM reported as validly signed by the vendor's key. Pipelines that gate deployment, admission or vulnerability management on this check would then act on attacker-chosen content, such as a component list that hides a malicious dependency.
The signer's private key is not exposed, and signatures produced by cdxgen are not weakened. The problem is that verification accepted documents the key holder never signed.
Affected versions
`@cyclonedx/cdxgen` 12.2.0 through 12.8.4 and `@cdxgen/cdxgen` 13.0.0 through 13.2.0, together with the container images and the standalone `cdx-verify`, `cdx-sign` and `cdx-validate` binaries built from those versions. Releases before 12.2.0 did not include JSF signature verification.
Patches
Fixed in 12.8.5 and 13.3.0. The declared algorithm is now honoured only when the verification key has exactly the matching type, so an `Ed25519` signature needs an Ed25519 key, an `ES256` signature needs a P-256 key, and so on. HMAC signatures are checked only against a shared secret passed explicitly with the new `--secret-key` option, or a secret `KeyObject` from `loadSharedSecret()` when using the library. A key given with `--public-key` is always treated as a public key.
The same releases also bring signing in line with the JSF specification: each signature now covers its own `algorithm`, `keyId` and `publicKey`, and each `chain` entry covers the entries before it. As a result, BOMs signed with an affected version no longer verify and must be re-signed with the fixed `cdx-sign`, as described in the cdx-sign documentation https://cdxgen.github.io/cdxgen/#/CDX_SIGN?id=re-signing-boms-from-earlier-releases. cdxgen also now exits with a non-zero status when signing is configured but fails, instead of writing or uploading an unsigned BOM.
Fix branches and commits
The 13.x fix is on the `fix/jsf-signature-binding` https://github.com/cdxgen/cdxgen/tree/fix/jsf-signature-binding branch. The core change, which binds each algorithm to its key type and requires an explicit shared secret for HMAC, is in `8c98d7f8` https://github.com/cdxgen/cdxgen/commit/8c98d7f8961715e6230784e69475664450abbbca and `46b2f8bb` https://github.com/cdxgen/cdxgen/commit/46b2f8bb5c4683f03bd99306ab90e1ea4e1b3d93. The follow-up hardening from review, covering fail-closed signing in cdxgen, chain history checks in cdx-sign, and nested signature checks in cdx-validate, is in `75de567d` https://github.com/cdxgen/cdxgen/commit/75de567d5a7f39798df598f0ad8f5124284309aa and `b10b5ed8` https://github.com/cdxgen/cdxgen/commit/b10b5ed8cb973705d46f4f9e5f308cf391b62a25. Documentation is in `8e89565a` https://github.com/cdxgen/cdxgen/commit/8e89565a34a0ffd89633641e58dff4272647cd5c and `87e1b54e` https://github.com/cdxgen/cdxgen/commit/87e1b54e5eaa958e519cc75e4382097aa999f348.
The 12.8 backport is on the `fix/jsf-signature-binding-v12` https://github.com/cdxgen/cdxgen/tree/fix/jsf-signature-binding-v12 branch, based on `release/12.0.x`. It carries the same changes in `6887cfa9` https://github.com/cdxgen/cdxgen/commit/6887cfa9ac144d54bae072202a478a1ed52280e5 and `31898f34` https://github.com/cdxgen/cdxgen/commit/31898f34dd813ed62495331642bc7332ef0ddf2e, with documentation in `40193631` https://github.com/cdxgen/cdxgen/commit/4019363194904bd235922f07be938083bafbb5d0.
Workarounds
Upgrading is the only complete fix. Until then, refuse any BOM that declares an HMAC algorithm anywhere in its signatures before running `cdx-verify`, unless you deliberately use shared-secret signing. The following command exits with status 0 when such a signature is present:
jq -e '[.. | objects | .signature? | objects | .. | objects | .algorithm? | strings] | any(startswith("HS"))' bom.jsonReferences
The fix for 13.x is in pull request #4400 https://github.com/cdxgen/cdxgen/pull/4400, and the 12.8 backport is in pull request #4401 https://github.com/cdxgen/cdxgen/pull/4401. The re-signing steps are in the cdx-sign documentation https://cdxgen.github.io/cdxgen/#/CDX_SIGN?id=re-signing-boms-from-earlier-releases, and the signature format is the JSON Signature Format (JSF) https://cyberphone.github.io/doc/security/jsf.html.
Credits
Thanks to @richilino for reporting that cdxgen did not check the declared signature algorithm against the key type. Following that report led to this issue.
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.5 | 0 d | 12.9.2 no afectada |
12.8.513.3.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-7m2v-pj5r-fjwwLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
