CVE-2022-23649: Github.com/sigstore/cosign Improper Certificate Validation Vulnerability

LOW
Advisory Identifier: GHSA-ccxc-vr6p-4858
CVSS 3.3
CWE-295
Published
Advisory Summary

CVE-2022-23649 is a LOW (CVSS 3.3) improper certificate validation vulnerability (CWE-295: Improper Certificate Validation) affecting Github.com/sigstore/cosign libraries in the Go ecosystem. The issue involves improper certificate validation in cosign. Remediation is available by upgrading affected packages to version 1.5.2.

CVE-2022-23649 at a Glance

CVE Identifier CVE-2022-23649
GHSA Identifier GHSA-ccxc-vr6p-4858
Severity LOW
CVSS v3.1 Base Score 3.3
CWE Classification CWE-295: Improper Certificate Validation
Affected Product Github.com/sigstore/cosign
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 3.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2022-23649

To remediate this vulnerability, upgrade all affected Github.com/sigstore/cosign dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/sigstore/cosign fixed: 1.5.2
Upgrade github.com/sigstore/cosign to 1.5.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/sigstore/cosign

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-23649, inspect your project dependencies for Github.com/sigstore/cosign:

inspect dependencies for github.com/sigstore/cosign

Analyze the terminal output to locate any version of Github.com/sigstore/cosign in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.5.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-295: Improper Certificate Validation, where the product does not validate, or incorrectly validates, a certificate. In Github.com/sigstore/cosign, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Cosign can be manipulated to claim that an entry for a signature exists in the Rekor transparency log even if it doesn't. This requires the attacker to have pull and push permissions for the signature in OCI. This can happen with both standard signing with a keypair and "keyless signing" with Fulcio. #### Signing with a keypair <details> To reproduce this vulnerability, create a keypair and sign an image. Don't store the signature in Rekor: ``` $ cosign generate-key-pair $ cosign sign --key cosign.key IMAGE ``` If an attacker has access to the signature in OCI, they can manipulate cosign into believing the entry was stored in Rekor even though it wasn't. To accomplish this, the attacker needs to: 1. Pull the signature image 2. Annotate the signature image with any valid Rekor bundle under the `dev.sigstore.cosign/bundle` annotation 3. Push the signature image back to OCI Verification then prints out the following: ``` $ cosign verify [--key] [IMAGE] Verification for [IMAGE] -- The following checks were performed on each of these signatures: - The cosign claims were validated - Existence of the claims in the transparency log was verified offline - The signatures were verified against the specified public key - Any certificates were verified against the Fulcio roots. […] ``` The claim that `Existence of the claims in the transparency log was verified offline` is inaccurate since an entry for this image doesn't exist in the log. The claim that `Any certificates were verified against the Fulcio roots.` is technically correct but since there were no certificates that should be explicitly called out. </details> #### "Keyless signing" with an OIDC flow <details> To reproduce this vulnerability, sign the image with a Fulcio identity. Don't store the signature in Rekor: ``` $ COSIGN_EXPERIMENTAL=1 cosign sign IMAGE [...] IMAGE appears to be a private repository, please confirm uploading to the transparency log at "https://rekor.sigstore.dev" [Y/N]: n ``` Then, create a keypair and sign the image again. Store an entry for the signature in Rekor: ``` $ cosign generate-key-pair $ COSIGN_EXPERIMENTAL=1 cosign sign --key cosign.key IMAGE Enter password for private key: IMAGE appears to be a private repository, please confirm uploading to the transparency log at "https://rekor.sigstore.dev" [Y/N]: y ``` If an attacker has access to the signature in OCI, they can manipulate cosign into believing the entry was stored in Rekor even though it wasn't. To accomplish this, the attacker needs to: 1. Pull the signature image 2. Copy the rekor bundle from the second signature into the first signature under the `dev.sigstore.cosign/bundle` annotation 3. Push the signature image back to OCI _Note: For this to work, both signatures must occur during the valid lifespan of the certificate (~20 minutes)._ Verification then prints out the following: ``` $ cosign verify [--key] [IMAGE] Verification for [IMAGE] -- The following checks were performed on each of these signatures: - The cosign claims were validated - Existence of the claims in the transparency log was verified offline - The signatures were verified against the specified public key - Any certificates were verified against the Fulcio roots. […] ``` The claim that `Existence of the claims in the transparency log was verified offline` is inaccurate since an entry for this image doesn't exist in the log. The claim that `Any certificates were verified against the Fulcio roots.` is technically correct but since there were no certificates that should be explicitly called out. </details> ### Patches The vulnerability has been patched in v1.5.2 of cosign. The `signature` in the `signedEntryTimestamp` provided by Rekor is now compared to the `signature` that is being verified. If these don't match, then an error is returned. If a valid bundle is copied to a different signature, verification should fail. Cosign output now only informs the user that certificates were verified if a certificate was in fact verified. ### Workarounds The only workaround is upgrading. ### For more information If you have any questions or comments about this advisory: * Open an issue in [cosign](https://github.com/sigstore/cosign) * Send us a message on [Slack](https://sigstore.slack.com/). Invite link [here](https://join.slack.com/t/sigstore/shared_invite/zt-mhs55zh0-XmY3bcfWn4XEyMqUUutbUQ). ### Thank you Thank you to @mtrmac for finding and reporting this vulnerability. Thank you to everyone who worked on fixing this: * @nsmith5 * @znewman01 * @dlorenc * @mattmoor * @priyawadhwa

CVE-2022-23649 Affected Github.com/sigstore/cosign Versions

1 component(s)
Fixed Versions:
1.5.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/sigstore/cosign
Go
< 1.5.2
1.5.2

References

Frequently Asked Questions

What is CVE-2022-23649?
CVE-2022-23649 is a security vulnerability in Github.com/sigstore/cosign involving Improper Certificate Validation in Cosign under CWE-295: Improper Certificate Validation.
Which Github.com/sigstore/cosign versions are affected?
Affected versions include releases prior to 1.5.2 across affected packages: github.com/sigstore/cosign.
What version fixes CVE-2022-23649?
Upgrading to 1.5.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/sigstore/cosign affected?
Yes, github.com/sigstore/cosign is affected in releases prior to 1.5.2. Upgrade your dependency to 1.5.2 or later.
What is the CVSS score of CVE-2022-23649?
CVE-2022-23649 has a CVSS v3.1 base score of 3.3 (LOW) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2022-23649?
CVE-2022-23649 is classified under CWE-295: Improper Certificate Validation (The product does not validate, or incorrectly validates, a certificate.).
How can I check Go dependencies for CVE-2022-23649?
Run the dependency tree command: 'inspect dependencies for github.com/sigstore/cosign'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-ccxc-vr6p-4858",
  "modified" : "2022-03-08T18:26:05Z",
  "published" : "2022-02-22T19:34:09Z",
  "aliases" : [ "CVE-2022-23649" ],
  "summary" : "Improper Certificate Validation in Cosign",
  "details" : "### Impact\n\nCosign can be manipulated to claim that an entry for a signature exists in the Rekor transparency log even if it doesn't. This requires the attacker to have pull and push permissions for the signature in OCI. This can happen with both standard signing with a keypair and \"keyless signing\" with Fulcio.\n\n#### Signing with a keypair\n\n<details>\n\nTo reproduce this vulnerability, create a keypair and sign an image. Don't store the signature in Rekor:\n\n```\n$ cosign generate-key-pair       \n$ cosign sign --key cosign.key IMAGE\n```\n\nIf an attacker has access to the signature in OCI, they can manipulate cosign into believing the entry was stored in Rekor even though it wasn't. To accomplish this, the attacker needs to:\n\n1. Pull the signature image\n2. Annotate the signature image with any valid Rekor bundle under the `dev.sigstore.cosign/bundle` annotation\n3. Push the signature image back to OCI\n\nVerification then prints out the following:\n\n```\n$ cosign verify [--key]  [IMAGE]\n\nVerification for [IMAGE] --\nThe following checks were performed on each of these signatures:\n  - The cosign claims were validated\n  - Existence of the claims in the transparency log was verified offline\n  - The signatures were verified against the specified public key\n  - Any certificates were verified against the Fulcio roots.\n\n[…]\n```\n\nThe claim that `Existence of the claims in the transparency log was verified offline` is inaccurate since an entry for this image doesn't exist in the log.\nThe claim that `Any certificates were verified against the Fulcio roots.` is technically correct but since there were no certificates that should be explicitly called out.\n\n</details>\n\n#### \"Keyless signing\" with an OIDC flow\n\n<details>\n\nTo reproduce this vulnerability, sign the image with a Fulcio identity. Don't store the signature in Rekor: \n```\n$ COSIGN_EXPERIMENTAL=1 cosign sign IMAGE\n[...]\nIMAGE appears to be a private repository, please confirm uploading to the transparency log at \"https://rekor.sigstore.dev\" [Y/N]: n\n\n```\n\nThen, create a keypair and sign the image again. Store an entry for the signature in Rekor:\n\n```\n$ cosign generate-key-pair       \n$ COSIGN_EXPERIMENTAL=1 cosign sign --key cosign.key IMAGE\n\nEnter password for private key: IMAGE appears to be a private repository, please confirm uploading to the transparency log at \"https://rekor.sigstore.dev\" [Y/N]: y\n```\n\nIf an attacker has access to the signature in OCI, they can manipulate cosign into believing the entry was stored in Rekor even though it wasn't. To accomplish this, the attacker needs to:\n\n1. Pull the signature image\n2. Copy the rekor bundle from the second signature into the first signature under the `dev.sigstore.cosign/bundle` annotation\n3. Push the signature image back to OCI\n\n_Note: For this to work, both signatures must occur during the valid lifespan of the certificate (~20 minutes)._\n\nVerification then prints out the following:\n\n```\n$ cosign verify [--key]  [IMAGE]\n\nVerification for [IMAGE] --\nThe following checks were performed on each of these signatures:\n  - The cosign claims were validated\n  - Existence of the claims in the transparency log was verified offline\n  - The signatures were verified against the specified public key\n  - Any certificates were verified against the Fulcio roots.\n\n[…]\n```\n\nThe claim that `Existence of the claims in the transparency log was verified offline` is inaccurate since an entry for this image doesn't exist in the log.\n\nThe claim that `Any certificates were verified against the Fulcio roots.` is technically correct but since there were no certificates that should be explicitly called out.\n\n</details>\n\n\n### Patches\nThe vulnerability has been patched in v1.5.2 of cosign.\n\nThe `signature` in the `signedEntryTimestamp` provided by Rekor is now compared to the `signature` that is being verified. If these don't match, then an error is returned. If a valid bundle is copied to a different signature, verification should fail. \n\nCosign output now only informs the user that certificates were verified if a certificate was in fact verified.\n\n\n### Workarounds\nThe only workaround is upgrading.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [cosign](https://github.com/sigstore/cosign)\n* Send us a message on [Slack](https://sigstore.slack.com/). Invite link [here](https://join.slack.com/t/sigstore/shared_invite/zt-mhs55zh0-XmY3bcfWn4XEyMqUUutbUQ).\n\n### Thank you\nThank you to @mtrmac for finding and reporting this vulnerability.\n\nThank you to everyone who worked on fixing this:\n* @nsmith5\n* @znewman01 \n* @dlorenc\n* @mattmoor \n* @priyawadhwa\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/sigstore/cosign"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.5.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/sigstore/cosign/security/advisories/GHSA-ccxc-vr6p-4858"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-23649"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sigstore/cosign/commit/96d410a6580e4e81d24d112a0855c70ca3fb5b49"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sigstore/cosign"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sigstore/cosign/releases/tag/v1.5.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-295" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-02-22T19:34:09Z",
    "nvd_published_at" : "2022-02-18T22:15:00Z"
  }
}