ghsa-ccxc-vr6p-4858
Vulnerability from github
Published
2022-02-22 19:34
Modified
2022-03-08 18:26
Summary
Improper Certificate Validation in Cosign
Details

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

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.

"Keyless signing" with an OIDC flow

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.

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 * Send us a message on Slack. Invite link here.

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

Show details on source website


{
  "affected": [
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/sigstore/cosign"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.5.2"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2022-23649"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-295"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2022-02-22T19:34:09Z",
    "nvd_published_at": "2022-02-18T22:15:00Z",
    "severity": "LOW"
  },
  "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\u0027t. 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\u003cdetails\u003e\n\nTo reproduce this vulnerability, create a keypair and sign an image. Don\u0027t 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\u0027t. 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[\u2026]\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\u0027t 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\u003c/details\u003e\n\n#### \"Keyless signing\" with an OIDC flow\n\n\u003cdetails\u003e\n\nTo reproduce this vulnerability, sign the image with a Fulcio identity. Don\u0027t 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\u0027t. 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[\u2026]\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\u0027t 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\u003c/details\u003e\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\u0027t 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",
  "id": "GHSA-ccxc-vr6p-4858",
  "modified": "2022-03-08T18:26:05Z",
  "published": "2022-02-22T19:34:09Z",
  "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"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Improper Certificate Validation in Cosign"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.