Cosign fixes attestation bug that let forged content pass type and policy checks; update to 2.6.6 or 3.1.6
A moderate advisory for the Sigstore tool cosign, GHSA-m887-h3mp-ww97, has been published. For attestations stored in the legacy tag format, two different JSON decoders can read the same envelope differently, so a signature check passes while type and policy checks run on another payload. Fixed versions are 2.6.6 and 3.1.6.
Why it matters
According to the advisory, encoding/json matches struct fields case-insensitively and the last matching key wins. An envelope containing a lowercase payload key followed by a capitalised Payload key has two readings: the verifier checks the signature on the second value, while the type check, CUE or Rego policy evaluation and printed output use the first.
The attacker needs to change repository content in the registry and does not need the signing key. The advisory says forged content such as SLSA provenance or an SBOM can then be accepted as signed by a trusted key, for any image that already has at least one envelope signed by that key. It is not a bypass for unsigned images.
Affected are cosign 2.6.5 and earlier and the v3 Go module 3.1.5 and earlier; releases earlier than those tested were not tested. Teams that gate deployments on verify-attestation with type or policy should upgrade to 2.6.6 or 3.1.6 and re-verify images that rely on legacy-format attestations.