GHSA-CCXC-VR6P-4858

Vulnerability from github – Published: 2022-02-22 19:34 – Updated: 2022-03-08 18:26
VLAI
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…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.