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

HIGH
Advisory Identifier: GHSA-9c5w-9q3f-3hv7
CVSS 7.5
CWE-400
Published
Advisory Summary

CVE-2024-34084 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Github.com/stacklok/minder libraries in the Go ecosystem. The issue involves minder's github webhook handler vulnerable to dos from un-validated requests. Remediation is available by upgrading affected packages to version 0.0.48.

CVE-2024-34084 at a Glance

CVE Identifier CVE-2024-34084
GHSA Identifier GHSA-9c5w-9q3f-3hv7
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Github.com/stacklok/minder
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
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-34084

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.48
Upgrade github.com/stacklok/minder to 0.0.48
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-34084, 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.48), 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. 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's `HandleGithubWebhook` is susceptible to a denial of service attack from an untrusted HTTP request. The vulnerability exists before the request has been validated, and as such the request is still untrusted at the point of failure. This allows an attacker with the ability to send requests to `HandleGithubWebhook` to crash the Minder controlplane and deny other users from using it. One of the first things that `HandleGithubWebhook` does is to validate the payload signature. This is done by way of the internal helper `validatePayloadSignature`: https://github.com/stacklok/minder/blob/ee66f6c0763212503c898cfefb65ce1450c7f5ac/internal/controlplane/handlers_githubwebhooks.go#L213-L218 `validatePayloadSignature` generates a reader from the incoming request by way of the internal helper `readerFromRequest`: https://github.com/stacklok/minder/blob/ee66f6c0763212503c898cfefb65ce1450c7f5ac/internal/controlplane/handlers_githubwebhooks.go#L337-L342 To create a reader from the incoming request, `readerFromRequest` first reads the request body entirely into memory on line 368: https://github.com/stacklok/minder/blob/ee66f6c0763212503c898cfefb65ce1450c7f5ac/internal/controlplane/handlers_githubwebhooks.go#L367-L377 This is a vulnerability, since an HTTP request with a large body can exhaust the memory of the machine running Minder and cause the Go runtime to crash Minder. Note that this occurs before Minder has validated the request, and as such, the request is still untrusted. To test this out, we can use the existing `TestHandleWebHookRepository` unit test and modify the HTTP request body to be large. To do that, change these lines: https://github.com/stacklok/minder/blob/ee66f6c0763212503c898cfefb65ce1450c7f5ac/internal/controlplane/handlers_githubwebhooks_test.go#L278-L283 ... to these lines: ```go packageJson, err := json.Marshal(event) require.NoError(t, err, "failed to marshal package event") maliciousBody := strings.NewReader(strings.Repeat("1337", 1000000000)) maliciousBodyReader := io.MultiReader(maliciousBody, maliciousBody, maliciousBody, maliciousBody, maliciousBody) _ = packageJson client := &http.Client{} req, err := http.NewRequest("POST", fmt.Sprintf("http://%s", addr), maliciousBodyReader) require.NoError(t, err, "failed to create request") ``` Then run the unit test again. WARNING, SAVE ALL WORK BEFORE DOING THIS. On my local machine, this causes the machine to freeze, and Go finally performs a sigkill: ``` signal: killed FAIL github.com/stacklok/minder/internal/controlplane 30.759s FAIL ```

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

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

References

Frequently Asked Questions

What is CVE-2024-34084?
CVE-2024-34084 is a security vulnerability in Github.com/stacklok/minder involving Minder's GitHub Webhook Handler vulnerable to DoS from un-validated requests under CWE-400: Uncontrolled Resource Consumption.
Which Github.com/stacklok/minder versions are affected?
Affected versions include releases prior to 0.0.48 across affected packages: github.com/stacklok/minder.
What version fixes CVE-2024-34084?
Upgrading to 0.0.48 (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.48. Upgrade your dependency to 0.0.48 or later.
What is the CVSS score of CVE-2024-34084?
CVE-2024-34084 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2024-34084?
CVE-2024-34084 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check Go dependencies for CVE-2024-34084?
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-9c5w-9q3f-3hv7",
  "modified" : "2024-05-10T21:33:54Z",
  "published" : "2024-05-07T13:02:42Z",
  "aliases" : [ "CVE-2024-34084" ],
  "summary" : "Minder's GitHub Webhook Handler vulnerable to DoS from un-validated requests",
  "details" : "Minder's `HandleGithubWebhook` is susceptible to a denial of service attack from an untrusted HTTP request. The vulnerability exists before the request has been validated, and as such the request is still untrusted at the point of failure. This allows an attacker with the ability to send requests to `HandleGithubWebhook` to crash the Minder controlplane and deny other users from using it.\n\nOne of the first things that `HandleGithubWebhook` does is to validate the payload signature. This is done by way of the internal helper `validatePayloadSignature`:\n\nhttps://github.com/stacklok/minder/blob/ee66f6c0763212503c898cfefb65ce1450c7f5ac/internal/controlplane/handlers_githubwebhooks.go#L213-L218\n\n`validatePayloadSignature` generates a reader from the incoming request by way of the internal helper `readerFromRequest`:\n\nhttps://github.com/stacklok/minder/blob/ee66f6c0763212503c898cfefb65ce1450c7f5ac/internal/controlplane/handlers_githubwebhooks.go#L337-L342\n\nTo create a reader from the incoming request, `readerFromRequest` first reads the request body entirely into memory on line 368:\n\nhttps://github.com/stacklok/minder/blob/ee66f6c0763212503c898cfefb65ce1450c7f5ac/internal/controlplane/handlers_githubwebhooks.go#L367-L377\n\nThis is a vulnerability, since an HTTP request with a large body can exhaust the memory of the machine running Minder and cause the Go runtime to crash Minder.\n\nNote that this occurs before Minder has validated the request, and as such, the request is still untrusted.\n\nTo test this out, we can use the existing `TestHandleWebHookRepository` unit test and modify the HTTP request body to be large. \n\nTo do that, change these lines:\n\nhttps://github.com/stacklok/minder/blob/ee66f6c0763212503c898cfefb65ce1450c7f5ac/internal/controlplane/handlers_githubwebhooks_test.go#L278-L283\n\n... to these lines:\n```go\n\tpackageJson, err := json.Marshal(event)\n\trequire.NoError(t, err, \"failed to marshal package event\")\n\n        maliciousBody := strings.NewReader(strings.Repeat(\"1337\", 1000000000))\n        maliciousBodyReader := io.MultiReader(maliciousBody, maliciousBody, maliciousBody, maliciousBody, maliciousBody)\n        _ = packageJson\n\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"POST\", fmt.Sprintf(\"http://%s\", addr), maliciousBodyReader)\n\trequire.NoError(t, err, \"failed to create request\")\n```\n\nThen run the unit test again. WARNING, SAVE ALL WORK BEFORE DOING THIS.\n\nOn my local machine, this causes the machine to freeze, and Go finally performs a sigkill: \n\n```\nsignal: killed\nFAIL      github.com/stacklok/minder/internal/controlplane          30.759s\nFAIL\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/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.48"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/stacklok/minder/security/advisories/GHSA-9c5w-9q3f-3hv7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-34084"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/stacklok/minder/commit/3e5a527d2f1b535159206161d1d519602c75bd0d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/stacklok/minder"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/stacklok/minder/blob/ee66f6c0763212503c898cfefb65ce1450c7f5ac/internal/controlplane/handlers_githubwebhooks.go#L213-L218"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/stacklok/minder/blob/ee66f6c0763212503c898cfefb65ce1450c7f5ac/internal/controlplane/handlers_githubwebhooks.go#L337-L342"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/stacklok/minder/blob/ee66f6c0763212503c898cfefb65ce1450c7f5ac/internal/controlplane/handlers_githubwebhooks.go#L367-L377"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/stacklok/minder/blob/ee66f6c0763212503c898cfefb65ce1450c7f5ac/internal/controlplane/handlers_githubwebhooks_test.go#L278-L283"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-07T13:02:42Z",
    "nvd_published_at" : "2024-05-07T15:15:09Z"
  }
}