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

MODERATE
Advisory Identifier: GHSA-crgc-2583-rw27
CVSS 5.3
CWE-400
Published
Advisory Summary

CVE-2024-35194 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Github.com/stacklok/minder libraries in the Go ecosystem. The issue involves stacklok minder vulnerable to denial of service from maliciously crafted templates. Remediation is available by upgrading affected packages to version 0.0.50.

CVE-2024-35194 at a Glance

CVE Identifier CVE-2024-35194
GHSA Identifier GHSA-crgc-2583-rw27
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-400: Uncontrolled Resource Consumption
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-35194

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.50
Upgrade github.com/stacklok/minder to 0.0.50
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-35194, 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.50), 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 engine is susceptible to a denial of service from memory exhaustion that can be triggered from maliciously created templates. Minder engine uses templating to generate strings for various use cases such as URLs, messages for pull requests, descriptions for advisories. In some cases can the user control both the template and the params for it, and in a subset of these cases, Minder reads the generated template entirely into memory. When Minders templating meets both of these conditions, an attacker is able to generate large enough templates that Minder will exhaust memory and crash. One of these places is the REST ingester: https://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/engine/ingester/rest/rest.go#L115-L123 With control over both endpoint and `retp` on the following line: https://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/engine/ingester/rest/rest.go#L121 … an attacker can make Minder generate a large template that Minder reads into memory on the following line by invoking `endpoint.String()`: https://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/engine/ingester/rest/rest.go#L131 Consider this example: ```go package main import ( "fmt" "html/template" "os" ) type EndpointTemplateParams struct { // Params are the parameters to be used in the template Params map[string]any } func main() { retp := &EndpointTemplateParams{ Params: map[string]any{ "params": make([]string, 10), }, } fmt.Println(retp) const templ = ` {{range $idx, $e := .Params.params}} loooooooooooooooooooooooooooooooong-string-{{$idx}} {{end}} {{range $idx, $e := .Params.params}} loooooooooooooooooooooooooooooooong-string-{{$idx}} {{end}} {{range $idx, $e := .Params.params}} loooooooooooooooooooooooooooooooong-string-{{$idx}} {{end}}` tmpl := template.Must(template.New("").Parse(templ)) if err := tmpl.Execute(os.Stdout, retp); err != nil { panic(err) } } ``` This example imitates the behavior on these lines: https://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/engine/ingester/rest/rest.go#L115-L123 Running this example generates the following template: ``` loooooooooooooooooooooooooooooooong-string-0 loooooooooooooooooooooooooooooooong-string-1 loooooooooooooooooooooooooooooooong-string-2 loooooooooooooooooooooooooooooooong-string-3 loooooooooooooooooooooooooooooooong-string-4 loooooooooooooooooooooooooooooooong-string-5 loooooooooooooooooooooooooooooooong-string-6 loooooooooooooooooooooooooooooooong-string-7 loooooooooooooooooooooooooooooooong-string-8 loooooooooooooooooooooooooooooooong-string-9 loooooooooooooooooooooooooooooooong-string-0 loooooooooooooooooooooooooooooooong-string-1 loooooooooooooooooooooooooooooooong-string-2 loooooooooooooooooooooooooooooooong-string-3 loooooooooooooooooooooooooooooooong-string-4 loooooooooooooooooooooooooooooooong-string-5 loooooooooooooooooooooooooooooooong-string-6 loooooooooooooooooooooooooooooooong-string-7 loooooooooooooooooooooooooooooooong-string-8 loooooooooooooooooooooooooooooooong-string-9 loooooooooooooooooooooooooooooooong-string-0 loooooooooooooooooooooooooooooooong-string-1 loooooooooooooooooooooooooooooooong-string-2 loooooooooooooooooooooooooooooooong-string-3 loooooooooooooooooooooooooooooooong-string-4 loooooooooooooooooooooooooooooooong-string-5 loooooooooooooooooooooooooooooooong-string-6 loooooooooooooooooooooooooooooooong-string-7 loooooooooooooooooooooooooooooooong-string-8 loooooooooooooooooooooooooooooooong-string-9 ``` A malicious user can call the loop more times, increase the loop count and/or make the repeated long string longer to make the size of the template bigger. A sufficiently large template will consume a lot of memory on this line which will exhaust memory on the machine and crash the Minder server: https://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/engine/ingester/rest/rest.go#L121 Minder should enforce a limit to generated templates before reading them into memory. The following templates are believed to be vulnerable: https://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/engine/ingester/rest/rest.go#L121 https://github.com/stacklok/minder/blob/e7f9914de9af5a69e3e6fe2bdfaaf22e62be42c0/internal/engine/actions/remediate/pull_request/pull_request.go#L199 https://github.com/stacklok/minder/blob/e7f9914de9af5a69e3e6fe2bdfaaf22e62be42c0/internal/engine/actions/remediate/pull_request/pull_request.go#L510 Minder has a few other templates especially in its engine which needs reviewing too. As a default, all templates should be limited in size before Minder reads them into memory.

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

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

References

Frequently Asked Questions

What is CVE-2024-35194?
CVE-2024-35194 is a security vulnerability in Github.com/stacklok/minder involving Stacklok Minder vulnerable to denial of service from maliciously crafted templates under CWE-400: Uncontrolled Resource Consumption.
Which Github.com/stacklok/minder versions are affected?
Affected versions include releases prior to 0.0.50 across affected packages: github.com/stacklok/minder.
What version fixes CVE-2024-35194?
Upgrading to 0.0.50 (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.50. Upgrade your dependency to 0.0.50 or later.
What is the CVSS score of CVE-2024-35194?
CVE-2024-35194 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-35194?
CVE-2024-35194 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-35194?
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-crgc-2583-rw27",
  "modified" : "2024-05-20T22:07:25Z",
  "published" : "2024-05-20T20:43:54Z",
  "aliases" : [ "CVE-2024-35194" ],
  "summary" : "Stacklok Minder vulnerable to denial of service from maliciously crafted templates",
  "details" : "Minder engine is susceptible to a denial of service from memory exhaustion that can be triggered from maliciously created templates.\n\nMinder engine uses templating to generate strings for various use cases such as URLs, messages for pull requests, descriptions for advisories. In some cases can the user control both the template and the params for it, and in a subset of these cases, Minder reads the generated template entirely into memory. When Minders templating meets both of these conditions, an attacker is able to generate large enough templates that Minder will exhaust memory and crash.\n\nOne of these places is the REST ingester:\n\nhttps://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/engine/ingester/rest/rest.go#L115-L123\n\nWith control over both endpoint and `retp` on the following line:\n\nhttps://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/engine/ingester/rest/rest.go#L121\n\n… an attacker can make Minder generate a large template that Minder reads into memory on the following line by invoking `endpoint.String()`:\n\nhttps://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/engine/ingester/rest/rest.go#L131\n\nConsider this example:\n\n```go\npackage main\n\nimport (\n        \"fmt\"\n        \"html/template\"\n        \"os\"\n)\n\ntype EndpointTemplateParams struct {\n        // Params are the parameters to be used in the template\n        Params map[string]any\n}\n\nfunc main() {\n        retp := &EndpointTemplateParams{\n                Params: map[string]any{\n                        \"params\": make([]string, 10),\n                },\n        }\n        fmt.Println(retp)\n        const templ = `\n        {{range $idx, $e := .Params.params}}\n    loooooooooooooooooooooooooooooooong-string-{{$idx}}\n{{end}}\n        {{range $idx, $e := .Params.params}}\n    loooooooooooooooooooooooooooooooong-string-{{$idx}}\n{{end}}\n        {{range $idx, $e := .Params.params}}\n    loooooooooooooooooooooooooooooooong-string-{{$idx}}\n{{end}}`\n        tmpl := template.Must(template.New(\"\").Parse(templ))\n        if err := tmpl.Execute(os.Stdout, retp); err != nil {\n                panic(err)\n        }\n}\n\n```\n\nThis example imitates the behavior on these lines:\n\nhttps://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/engine/ingester/rest/rest.go#L115-L123\n\nRunning this example generates the following template:\n\n```\n    loooooooooooooooooooooooooooooooong-string-0\n\n    loooooooooooooooooooooooooooooooong-string-1\n\n    loooooooooooooooooooooooooooooooong-string-2\n\n    loooooooooooooooooooooooooooooooong-string-3\n\n    loooooooooooooooooooooooooooooooong-string-4\n\n    loooooooooooooooooooooooooooooooong-string-5\n\n    loooooooooooooooooooooooooooooooong-string-6\n\n    loooooooooooooooooooooooooooooooong-string-7\n\n    loooooooooooooooooooooooooooooooong-string-8\n\n    loooooooooooooooooooooooooooooooong-string-9\n\n\n    loooooooooooooooooooooooooooooooong-string-0\n\n    loooooooooooooooooooooooooooooooong-string-1\n\n    loooooooooooooooooooooooooooooooong-string-2\n\n    loooooooooooooooooooooooooooooooong-string-3\n\n    loooooooooooooooooooooooooooooooong-string-4\n\n    loooooooooooooooooooooooooooooooong-string-5\n\n    loooooooooooooooooooooooooooooooong-string-6\n\n    loooooooooooooooooooooooooooooooong-string-7\n\n    loooooooooooooooooooooooooooooooong-string-8\n\n    loooooooooooooooooooooooooooooooong-string-9\n\n\n    loooooooooooooooooooooooooooooooong-string-0\n\n    loooooooooooooooooooooooooooooooong-string-1\n\n    loooooooooooooooooooooooooooooooong-string-2\n\n    loooooooooooooooooooooooooooooooong-string-3\n\n    loooooooooooooooooooooooooooooooong-string-4\n\n    loooooooooooooooooooooooooooooooong-string-5\n\n    loooooooooooooooooooooooooooooooong-string-6\n\n    loooooooooooooooooooooooooooooooong-string-7\n\n    loooooooooooooooooooooooooooooooong-string-8\n\n    loooooooooooooooooooooooooooooooong-string-9\n```\n\nA malicious user can call the loop more times, increase the loop count and/or make the repeated long string longer to make the size of the template bigger.\n\nA sufficiently large template will consume a lot of memory on this line which will exhaust memory on the machine and crash the Minder server:\n\nhttps://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/engine/ingester/rest/rest.go#L121\n\nMinder should enforce a limit to generated templates before reading them into memory.\n\nThe following templates are believed to be vulnerable:\n\nhttps://github.com/stacklok/minder/blob/daccbc12e364e2d407d56b87a13f7bb24cbdb074/internal/engine/ingester/rest/rest.go#L121\n\nhttps://github.com/stacklok/minder/blob/e7f9914de9af5a69e3e6fe2bdfaaf22e62be42c0/internal/engine/actions/remediate/pull_request/pull_request.go#L199\n\nhttps://github.com/stacklok/minder/blob/e7f9914de9af5a69e3e6fe2bdfaaf22e62be42c0/internal/engine/actions/remediate/pull_request/pull_request.go#L510\n\nMinder has a few other templates especially in its engine which needs reviewing too. As a default, all templates should be limited in size before Minder reads them into memory.\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.50"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/stacklok/minder/security/advisories/GHSA-crgc-2583-rw27"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-35194"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/stacklok/minder/commit/fe321d345b4f738de6a06b13207addc72b59f892"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/stacklok/minder"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-20T20:43:54Z",
    "nvd_published_at" : "2024-05-20T21:15:09Z"
  }
}