CVE-2024-35238: Github.com/stacklok/minder Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-8fmj-33gw-g7pw
CVSS 5.3
CWE-770
Published
Advisory Summary

CVE-2024-35238 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting Github.com/stacklok/minder libraries in the Go ecosystem. The issue involves denial of service of minder server from maliciously crafted github attestations. Remediation is available by upgrading affected packages to version 0.0.51.

CVE-2024-35238 at a Glance

CVE Identifier CVE-2024-35238
GHSA Identifier GHSA-8fmj-33gw-g7pw
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product Github.com/stacklok/minder
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.3

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

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

How to Fix CVE-2024-35238

To remediate this vulnerability, upgrade all affected Github.com/stacklok/minder 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/stacklok/minder fixed: 0.0.51
Upgrade github.com/stacklok/minder to 0.0.51
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/stacklok/minder

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-35238, inspect your project dependencies for Github.com/stacklok/minder:

inspect dependencies for github.com/stacklok/minder

Analyze the terminal output to locate any version of Github.com/stacklok/minder in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.51), 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-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In Github.com/stacklok/minder, 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

Minder is vulnerable to a denial-of-service (DoS) attack which could allow an attacker to crash the Minder server and deny other users access to it. The root cause of the vulnerability is that Minders sigstore verifier reads an untrusted response entirely into memory without enforcing a limit on the response body. An attacker can exploit this by making Minder make a request to an attacker-controlled endpoint which returns a response with a large body which will crash the Minder server. Specifically, the point of failure is where Minder parses the response from the GitHub attestations endpoint in `getAttestationReply`. Here, Minder makes a request to the `orgs/$owner/attestations/$checksumref` GitHub endpoint (line 285) and then parses the response into the `AttestationReply` (line 295): https://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/verifier/sigstore/container/container.go#L271-L300 The way Minder parses the response on line 295 makes it prone to DoS if the response is large enough. Essentially, the response needs to be larger than the machine has available memory. To demonstrate this in an isolated way, consider the following example: ```go package main import ( "encoding/json" "fmt" "io" "strings" ) type Attestation struct { Bundle json.RawMessage `json:"bundle"` } type AttestationReply struct { Attestations []Attestation `json:"attestations"` } func main() { m1 := strings.NewReader("{\"attestations\":[") maliciousBody := strings.NewReader(strings.Repeat("{\"bundle\":{\"k\": \"v\"{{,", 100000000)) m2 := strings.NewReader("{\"bundle\":{\"k\": \"v\"}}]}") maliciousBodyReader := io.MultiReader(m1, maliciousBody, maliciousBody, maliciousBody, m2) fmt.Println("Created malicious body") var attestationReply AttestationReply _ = json.NewDecoder(maliciousBodyReader).Decode(&attestationReply) } ``` This example mimics the behavior of Minders `getAttestationReply` and how a malicious response body passed to `getAttestationReply’s` parsing of the response will cause DoS. When running this script locally on my system, Go incrementally increases memory consumption up to above 90%, freezes the machine and then performs a sigkill. ## Attack vector The content that is hosted at the `orgs/$owner/attestations/$checksumref` GitHub attestation endpoint is controlled by users including unauthenticated users to Minders threat model. However, a user will need to configure their own Minder settings to cause Minder to make Minder send a request to fetch the attestations. The user would need to know of a package whose attestations were configured in such a way that they would return a large response when fetching them. As such, the steps needed to carry out this attack would look as such: 1. The attacker adds a package to ghcr.io with attestations that can be fetched via the `orgs/$owner/attestations/$checksumref` GitHub endpoint. 2. The attacker registers on Minder and makes Minder fetch the attestations. 3. Minder fetches attestations and crashes thereby being denied of service.

CVE-2024-35238 Affected Github.com/stacklok/minder Versions

1 component(s)
Fixed Versions:
0.0.51
Product / Package Ecosystem Affected Versions Fixed Version
github.com/stacklok/minder
Go
< 0.0.51
0.0.51

References

Frequently Asked Questions

What is CVE-2024-35238?
CVE-2024-35238 is a security vulnerability in Github.com/stacklok/minder involving Denial of service of Minder Server from maliciously crafted GitHub attestations under CWE-770: Allocation of Resources Without Limits or Throttling.
Which Github.com/stacklok/minder versions are affected?
Affected versions include releases prior to 0.0.51 across affected packages: github.com/stacklok/minder.
What version fixes CVE-2024-35238?
Upgrading to 0.0.51 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/stacklok/minder affected?
Yes, github.com/stacklok/minder is affected in releases prior to 0.0.51. Upgrade your dependency to 0.0.51 or later.
What is the CVSS score of CVE-2024-35238?
CVE-2024-35238 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2024-35238?
CVE-2024-35238 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check Go dependencies for CVE-2024-35238?
Run the dependency tree command: 'inspect dependencies for github.com/stacklok/minder'. 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-8fmj-33gw-g7pw",
  "modified" : "2024-05-28T16:55:02Z",
  "published" : "2024-05-28T16:55:02Z",
  "aliases" : [ "CVE-2024-35238" ],
  "summary" : "Denial of service of Minder Server from maliciously crafted GitHub attestations",
  "details" : "Minder is vulnerable to a denial-of-service (DoS) attack which could allow an attacker to crash the Minder server and deny other users access to it.\n\nThe root cause of the vulnerability is that Minders sigstore verifier reads an untrusted response entirely into memory without enforcing a limit on the response body. An attacker can exploit this by making Minder make a request to an attacker-controlled endpoint which returns a response with a large body which will crash the Minder server.\n\nSpecifically, the point of failure is where Minder parses the response from the GitHub attestations endpoint in `getAttestationReply`. Here, Minder makes a request to the `orgs/$owner/attestations/$checksumref` GitHub endpoint (line 285) and then parses the response into the `AttestationReply` (line 295):\n\nhttps://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/verifier/sigstore/container/container.go#L271-L300\n\nThe way Minder parses the response on line 295 makes it prone to DoS if the response is large enough. Essentially, the response needs to be larger than the machine has available memory.\n\nTo demonstrate this in an isolated way, consider the following example:\n\n```go\npackage main\n\nimport (\n        \"encoding/json\"\n        \"fmt\"\n        \"io\"\n        \"strings\"\n)\n\ntype Attestation struct {\n        Bundle json.RawMessage `json:\"bundle\"`\n}\n\ntype AttestationReply struct {\n        Attestations []Attestation `json:\"attestations\"`\n}\n\nfunc main() {\n        m1 := strings.NewReader(\"{\\\"attestations\\\":[\")\n        maliciousBody := strings.NewReader(strings.Repeat(\"{\\\"bundle\\\":{\\\"k\\\": \\\"v\\\"{{,\", 100000000))\n        m2 := strings.NewReader(\"{\\\"bundle\\\":{\\\"k\\\": \\\"v\\\"}}]}\")\n        maliciousBodyReader := io.MultiReader(m1, maliciousBody, maliciousBody, maliciousBody, m2)\n        fmt.Println(\"Created malicious body\")\n\n        var attestationReply AttestationReply\n        _ = json.NewDecoder(maliciousBodyReader).Decode(&attestationReply)\n}\n\n```\n\nThis example mimics the behavior of Minders `getAttestationReply` and how a malicious response body passed to `getAttestationReply’s` parsing of the response will cause DoS.\n\nWhen running this script locally on my system, Go incrementally increases memory consumption up to above 90%, freezes the machine and then performs a sigkill.\n\n## Attack vector\nThe content that is hosted at the `orgs/$owner/attestations/$checksumref` GitHub attestation endpoint is controlled by users including unauthenticated users to Minders threat model. However, a user will need to configure their own Minder settings to cause Minder to make Minder send a request to fetch the attestations. The user would need to know of a package whose attestations were configured in such a way that they would return a large response when fetching them. As such, the steps needed to carry out this attack would look as such:\n\n1. The attacker adds a package to ghcr.io with attestations that can be fetched via the `orgs/$owner/attestations/$checksumref` GitHub endpoint.\n2. The attacker registers on Minder and makes Minder fetch the attestations.\n3. Minder fetches attestations and crashes thereby being denied of service.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/stacklok/minder"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.51"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/stacklok/minder/security/advisories/GHSA-8fmj-33gw-g7pw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-35238"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/stacklok/minder/commit/fe321d345b4f738de6a06b13207addc72b59f892"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/stacklok/minder"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/verifier/sigstore/container/container.go#L271-L300"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-28T16:55:02Z",
    "nvd_published_at" : "2024-05-27T18:15:09Z"
  }
}