CVE-2024-21661: Github.com/argoproj/argo cd Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-6v85-wr92-q4p7
CVSS 7.5
CWE-787
Published
Advisory Summary

CVE-2024-21661 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-787: Out-of-bounds Write) affecting Github.com/argoproj/argo cd libraries in the Go ecosystem. The issue involves denial of service (dos) vulnerability due to unsafe array modification in multi-threaded environment. Remediation is available by upgrading affected packages to version 2.8.13, 2.9.9, 2.10.4.

CVE-2024-21661 at a Glance

CVE Identifier CVE-2024-21661
GHSA Identifier GHSA-6v85-wr92-q4p7
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-787: Out-of-bounds Write
Affected Product Github.com/argoproj/argo cd
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-21661

To remediate this vulnerability, upgrade all affected Github.com/argoproj/argo cd 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/argoproj/argo-cd fixed: Latest secure release
Upgrade github.com/argoproj/argo-cd to Latest secure release
github.com/argoproj/argo-cd/v2 fixed: 2.8.13
Upgrade github.com/argoproj/argo-cd/v2 to 2.8.13
github.com/argoproj/argo-cd/v2 fixed: 2.9.9
Upgrade github.com/argoproj/argo-cd/v2 to 2.9.9
github.com/argoproj/argo-cd/v2 fixed: 2.10.4
Upgrade github.com/argoproj/argo-cd/v2 to 2.10.4
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/argoproj/argo-cd

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-21661, inspect your project dependencies for Github.com/argoproj/argo cd:

inspect dependencies for github.com/argoproj/argo-cd

Analyze the terminal output to locate any version of Github.com/argoproj/argo cd in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.8.13), 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-787: Out-of-bounds Write, where the product writes data past the end, or before the beginning, of the intended buffer. In Github.com/argoproj/argo cd, 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 An attacker can exploit a critical flaw in the application to initiate a Denial of Service (DoS) attack, rendering the application inoperable and affecting all users. The issue arises from unsafe manipulation of an array in a multi-threaded environment. ### Details The vulnerability is rooted in the application's code, where an array is being modified while it is being iterated over. This is a classic programming error but becomes critically unsafe when executed in a multi-threaded environment. When two threads interact with the same array simultaneously, the application crashes. The core issue is located in [expireOldFailedAttempts](https://github.com/argoproj/argo-cd/blob/54601c8fd30b86a4c4b7eb449956264372c8bde0/util/session/sessionmanager.go#L302-L311) function: ```go func expireOldFailedAttempts(maxAge time.Duration, failures *map[string]LoginAttempts) int { expiredCount := 0 for key, attempt := range *failures { if time.Since(attempt.LastFailed) > maxAge*time.Second { expiredCount += 1 delete(*failures, key) // Vulnerable code } } return expiredCount } ``` The function modifies the array while iterating it which means the code will cause an error and crash the application pod, inspecting the logs just before the crash we can confirm: ```go goroutine 2032 [running]: github.com/argoproj/argo-cd/v2/util/session.expireOldFailedAttempts(0x12c, 0xc000adecd8) /go/src/github.com/argoproj/argo-cd/util/session/sessionmanager.go:304 +0x7c github.com/argoproj/argo-cd/v2/util/session.(*SessionManager).updateFailureCount(0xc00035 af50, {0xc001b1f578, 0x11}, 0x1) /go/src/github.com/argoproj/argo-cd/util/session/sessionmanager.go:320 +0x7f github.com/argoproj/argo-cd/v2/util/session.(*SessionManager).VerifyUsernamePassword(0xc 00035af50, {0xc001b1f578, 0x11}, {0xc000455148, 0x8}) ``` ### PoC To reproduce the vulnerability, you can use the following steps: 1. Launch the application. 2. Trigger the code path that results in the `expireOldFailedAttempts()` function being called in multiple threads. 3. In the attached PoC script we are restarting the server in a while loop, causing the application to be unresponsive at all. ### Impact This is a Denial of Service (DoS) vulnerability. Any attacker can crash the application continuously, making it impossible for legitimate users to access the service. The issue is exacerbated because it does not require authentication, widening the pool of potential attackers.

CVE-2024-21661 Affected Github.com/argoproj/argo cd Versions

4 component(s)
Fixed Versions:
2.8.132.9.92.10.4
Product / Package Ecosystem Affected Versions Fixed Version
github.com/argoproj/argo-cd
Go
≤ 1.8.7
github.com/argoproj/argo-cd/v2
Go
< 2.8.13
2.8.13
github.com/argoproj/argo-cd/v2
Go
≥ 2.9.0
< 2.9.9
2.9.9
github.com/argoproj/argo-cd/v2
Go
≥ 2.10.0
< 2.10.4
2.10.4

References

Frequently Asked Questions

What is CVE-2024-21661?
CVE-2024-21661 is a security vulnerability in Github.com/argoproj/argo cd involving Denial of Service (DoS) Vulnerability Due to Unsafe Array Modification in Multi-threaded Environment under CWE-787: Out-of-bounds Write.
Which Github.com/argoproj/argo cd versions are affected?
Affected versions include releases prior to 2.8.13, 2.9.9, 2.10.4 across affected packages: github.com/argoproj/argo-cd, github.com/argoproj/argo-cd/v2.
What version fixes CVE-2024-21661?
Upgrading to 2.8.13, 2.9.9, 2.10.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/argoproj/argo-cd affected?
Yes, github.com/argoproj/argo-cd is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
Is github.com/argoproj/argo-cd/v2 affected?
Yes, github.com/argoproj/argo-cd/v2 is affected in releases prior to 2.8.13, 2.9.9, 2.10.4. Upgrade your dependency to 2.8.13, 2.9.9, 2.10.4 or later.
What is the CVSS score of CVE-2024-21661?
CVE-2024-21661 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-21661?
CVE-2024-21661 is classified under CWE-787: Out-of-bounds Write (The product writes data past the end, or before the beginning, of the intended buffer.).
How can I check Go dependencies for CVE-2024-21661?
Run the dependency tree command: 'inspect dependencies for github.com/argoproj/argo-cd'. 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-6v85-wr92-q4p7",
  "modified" : "2024-05-20T22:03:12Z",
  "published" : "2024-03-18T20:28:42Z",
  "aliases" : [ "CVE-2024-21661" ],
  "summary" : "Denial of Service (DoS) Vulnerability Due to Unsafe Array Modification in Multi-threaded Environment",
  "details" : "### Summary\nAn attacker can exploit a critical flaw in the application to initiate a Denial of Service (DoS) attack, rendering the application inoperable and affecting all users. The issue arises from unsafe manipulation of an array in a multi-threaded environment.\n\n### Details\nThe vulnerability is rooted in the application's code, where an array is being modified while it is being iterated over. This is a classic programming error but becomes critically unsafe when executed in a multi-threaded environment. When two threads interact with the same array simultaneously, the application crashes.\n\nThe core issue is located in [expireOldFailedAttempts](https://github.com/argoproj/argo-cd/blob/54601c8fd30b86a4c4b7eb449956264372c8bde0/util/session/sessionmanager.go#L302-L311) function:\n```go\nfunc expireOldFailedAttempts(maxAge time.Duration, failures *map[string]LoginAttempts) int {\n\nexpiredCount := 0  \nfor key, attempt := range *failures {\n\nif time.Since(attempt.LastFailed) > maxAge*time.Second { expiredCount += 1  \ndelete(*failures, key) // Vulnerable code\n\n} }\n\nreturn expiredCount }\n```\n\nThe function modifies the array while iterating it which means the code will cause an error and crash the application pod, inspecting the logs just before the crash we can confirm:\n```go\ngoroutine 2032 [running]: github.com/argoproj/argo-cd/v2/util/session.expireOldFailedAttempts(0x12c, 0xc000adecd8)\n\n/go/src/github.com/argoproj/argo-cd/util/session/sessionmanager.go:304 +0x7c github.com/argoproj/argo-cd/v2/util/session.(*SessionManager).updateFailureCount(0xc00035 af50, {0xc001b1f578, 0x11}, 0x1)\n\n/go/src/github.com/argoproj/argo-cd/util/session/sessionmanager.go:320 +0x7f github.com/argoproj/argo-cd/v2/util/session.(*SessionManager).VerifyUsernamePassword(0xc 00035af50, {0xc001b1f578, 0x11}, {0xc000455148, 0x8})\n```\n### PoC\nTo reproduce the vulnerability, you can use the following steps:\n\n1. Launch the application.\n2. Trigger the code path that results in the `expireOldFailedAttempts()` function being called in multiple threads.\n3. In the attached PoC script we are restarting the server in a while loop, causing the application to be unresponsive at all.\n\n### Impact\nThis is a Denial of Service (DoS) vulnerability. Any attacker can crash the application continuously, making it impossible for legitimate users to access the service. The issue is exacerbated because it does not require authentication, widening the pool of potential attackers.",
  "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/argoproj/argo-cd"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "1.8.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/argoproj/argo-cd/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.8.13"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/argoproj/argo-cd/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.9.0"
      }, {
        "fixed" : "2.9.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/argoproj/argo-cd/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.10.0"
      }, {
        "fixed" : "2.10.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/argoproj/argo-cd/security/advisories/GHSA-6v85-wr92-q4p7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-21661"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/argoproj/argo-cd/commit/2a22e19e06aaf6a1e734443043310a66c234e345"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/argoproj/argo-cd/commit/5bbb51ab423f273dda74ab956469843d2db2e208"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/argoproj/argo-cd/commit/ce04dc5c6f6e92033221ec6d96b74403b065ca8b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/argoproj/argo-cd"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/argoproj/argo-cd/blob/54601c8fd30b86a4c4b7eb449956264372c8bde0/util/session/sessionmanager.go#L302-L311"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-787" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-18T20:28:42Z",
    "nvd_published_at" : "2024-03-18T19:15:06Z"
  }
}