Unveiling New Vulnerabilities in ArgoCD: A KTrust Research Insight

Nadav Aharon-Nov
Blog
18.3.24

The KTrust research team operates at the forefront of Kubernetes security, relentlessly pursuing the identification and mitigation of emerging threats. Their expertise is not confined to merely spotting vulnerabilities; it extends into a comprehensive analysis of how these vulnerabilities can be exploited. By meticulously reverse-engineering Common Vulnerabilities and Exposures (CVEs), the team uncovers the multifaceted attack strategies that could be leveraged by malicious actors. 

Recently, the KTrust research team has unveiled three significant vulnerabilities within ArgoCD, a widely-used GitOps continuous delivery tool for Kubernetes. These discoveries underscore the complex security challenges inherent in managing dynamic Kubernetes environments. In the following sections, we will explore the details of these vulnerabilities, assess their potential impact, and discuss why timely remediation is crucial for maintaining robust security postures.

1. Bypassing Rate Limit and Brute Force Protection Using Cache Overflow (CVE-2024-21662)

Severity: Moderate

Summary: This vulnerability exploits the application's cache-based mechanisms for rate limit and brute force protections. Attackers can bypass these security measures by overloading the cache system, specifically targeting the default admin account.

Detailed Breakdown : The vulnerability lies in the application's cache system, designed to track user login attempts. This cache has a maximum capacity of 1000 entries ( defaultMaxCacheSize ). We exploit this limitation by inundating the system with login attempts across various user accounts. This flood of attempts exceeds the cache's capacity, forcing it to discard older entries, including the failed login attempts of the admin account. As a result, the rate limit for the admin account is reset, leaving it exposed to further attacks.

The brute force protection mechanism's code:

if failed && len(failures) >=

getMaximumCacheSize() {

log.Warnf("Session cache size

exceeds %d entries, removing random

entry",

getMaximumCacheSize())

idx := rand.Intn(len(failures)

- 1)

var rmUser string

i := 0

for key := range failures {

if i == idx {

rmUser = key

delete(failures, key)

break

}

i++ }

log.Infof("Deleted entry for

user %s from cache", rmUser)

}

Impact: By flooding the system with login attempts, attackers force the cache to discard older entries, including those tracking failed admin account logins. This effectively resets the rate limit for the admin account, leaving it vulnerable to brute force attacks.

Why It Matters: This vulnerability exposes a critical oversight in the design of cache-based security mechanisms, which are widely relied upon to protect against brute force attacks. The ability to bypass these protections not only undermines the security posture of applications using ArgoCD but also sets a precedent for similar vulnerabilities in other systems. It underscores the necessity for developers to implement more resilient and adaptive security measures that can withstand unconventional attack vectors. This case specifically highlights the need for a security architecture that does not solely depend on rate limiting and cache sizes for protection, urging a reevaluation of how security mechanisms can be circumvented through systemic stress or overload.

2. Bypassing Brute Force Protection via Application Crash and In-Memory Data Loss (CVE-2024-21652)

Severity: Moderate

Summary: This method involves triggering a Denial of Service (DoS) attack that crashes the application, exploiting the in-memory data storage of failed login attempts. The crash resets the brute force protections, making user accounts vulnerable to repeated login attempts.

Detailed Breakdown : Our strategy exploits two primary weaknesses:

  1. Application Crash through Unsafe Array Handling: We leverage a known DoS vulnerability, stemming from improper handling of arrays in a multi-threaded environment, to crash the application.
  2. In-Memory Storage of Login Attempts: The application’s failure to store failed login attempts persistently plays into our hands. When it crashes and restarts, the data loss resets any brute force protection measures.

// LoginAttempts is a timestamped

counter for failed login attempts

type LoginAttempts struct {

// Time of the last failed login

LastFailed time.Time

`json:"lastFailed"` // Number of

consecutive login failures FailCount

int `json:"failCount"`

}

Impact: The combination of an application crash through unsafe array handling and the in-memory storage of login attempts allows attackers to reset the login attempt counter continuously. This significantly increases the risk of unauthorized account access.

Why It Matters: This vulnerability highlights a critical security flaw that allows attackers to bypass brute force protection mechanisms by exploiting a system's vulnerability to application crashes. Similar to CVE-2024-21662, where attackers bypass security measures through cache overflow, this issue also revolves around circumventing brute force protections. However, it uniquely leverages the application's inability to maintain the integrity of login attempt counters through crashes, effectively granting attackers unlimited attempts to compromise an account. This method of bypassing brute force protection is particularly concerning because it not only exploits a software vulnerability but also takes advantage of the application's operational resilience—or lack thereof. In essence, it turns a system's defense mechanism against itself, using the brute force protection reset caused by a crash to facilitate an attack. This vulnerability underscores the importance of designing security and operational systems that are resilient not just to direct attacks but also to indirect methods that exploit the consequences of system failures. It serves as a stark reminder that security measures must be comprehensive, covering not only the prevention of unauthorized access but also ensuring that protective mechanisms remain effective even when the system is under duress or operating in a degraded state.

Denial of Service (DoS) Vulnerability Due to Unsafe Array Modification in Multithreaded Environment (CVE-2024-21661)

Severity: High

Summary: This critical vulnerability allows attackers to initiate a DoS attack, rendering the application non-functional for all users. It stems from improper array manipulation in a multi-threaded environment.

Detailed Breakdown: This flaw exists in the application's coding practices. It occurs when an array is modified concurrently as it's being iterated over. While this is a common programming oversight, it turns critical in a multi-threaded environment. The application faces a crash when two threads modify the same array simultaneously The problem mainly arises in the expireOldFailedAttempts function:

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 alters the array during iteration, leading to errors and an eventual crash. This can be confirmed by inspecting the logs just before the crash:

goroutine 2032 [running]:

github.com/argoproj/argocd/

v2/util/session.expireOldFailedAtt

empts(0x12c, 0xc000adecd8)

/go/src/github.com/argoproj/argocd/

util/session/sessionmanager.go:304

+0x7c github.com/argoproj/argocd/

v2/util/session.

(*SessionManager).updateFailureCount(

0xc00035 af50, {0xc001b1f578, 0x11},

0x1)

/go/src/github.com/argoproj/argocd/

util/session/sessionmanager.go:320

+0x7f github.com/argoproj/argocd/

v2/util/session.

(*SessionManager).VerifyUsernamePassword(0xc 00035af50, {0xc001b1f578,

0x11}, {0xc000455148, 0x8})

Impact: Any attacker, without needing authentication, can repeatedly crash the application, making the service inaccessible to legitimate users. This vulnerability's exploitation does not require authentication, significantly increasing its risk.

Why It Matters: This vulnerability is a stark reminder of the dangers posed by concurrency issues in software development, especially in a multi-threaded environment. The ability to cause a Denial of Service through unsafe array modification not only disrupts service availability but also highlights a fundamental security flaw that can be exploited without sophisticated access or knowledge. This CVE is rated higher in severity than the other two because it affects all users indiscriminately and can be exploited with minimal effort, potentially leading to widespread disruption of services. The lack of authentication required to exploit this vulnerability significantly broadens the range of potential attackers, making it a critical threat to the application's availability and reliability. It emphasizes the importance of secure coding practices and thorough testing to prevent concurrency-related vulnerabilities, which can have severe implications for the security and stability of software systems.

Conclusion

The revelations brought forth by the KTrust research team underscore the critical importance of vigilant and comprehensive security practices in the realm of Kubernetes. These vulnerabilities in ArgoCD not only highlight the nuanced and evolving nature of threats but also the indispensable role of dedicated research in preempting potential breaches. Through their meticulous analysis the KTrust team exemplifies the depth of investigation and proactive stance necessary to stay ahead of cyber adversaries.  Argo is planning to come out with a fix, per their latest communication.

As we reflect on the implications of these vulnerabilities, it becomes evident that traditional security measures are no longer sufficient in the face of Kubernetes. The need for advanced, automated solutions is paramount ; Enter the KTrust Automated Red-Team Kubernetes Security Platform, a pioneering solution designed to navigate the complexities of Kubernetes security. By simulating real-world attack scenarios and continuously probing for vulnerabilities, KTrust offers an unparalleled level of security assurance.  We’d love to show you how we can do just that for you.  Get in touch today!

Discover Validated Exposures within Your Unique K8s Ecosystem within Minutes

By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.