Helm, Stack Overflow Vulnerability, CVE-2024-XXXX (Critical)

Listen to this Post

How the CVE Works:

The vulnerability (CVE-2024-XXXX) in Helm arises due to insufficient recursion depth validation when parsing JSON Schema files in Helm charts. An attacker can craft a malicious chart containing a deeply nested JSON Schema with recursive references. When Helm processes this schema, it triggers uncontrolled recursion in the parser, exceeding the stack size limit and causing a stack overflow. This can crash the Helm process, leading to denial-of-service (DoS) or potential remote code execution (RCE) if memory corruption occurs. The issue stems from Helm’s YAML/JSON parser failing to enforce depth limits during schema validation.

DailyCVE Form:

Platform: Helm
Version: <3.17.3
Vulnerability: Stack Overflow
Severity: Critical
Date: 2024-XX-XX

What Undercode Say:

Exploitation:

1. Craft Malicious Chart:

schema.yaml
{"$ref": "/definitions/loop", "definitions": {"loop": {"$ref": "/definitions/loop"}}}

2. Deploy Exploit:

helm install malicious-chart ./malicious-chart

Detection:

1. Check Helm Version:

helm version --short | grep -q "v3.17.3" || echo "Vulnerable"

2. Scan Charts:

grep -r "\$ref" ./charts --include=".json" | wc -l

Mitigation:

1. Patch Helm:

helm upgrade --install helm https://helm.sh/helm-v3.17.3

2. Schema Validation:

import yaml
def validate_schema(schema, depth=0):
if depth > 100: raise Exception("Max depth exceeded")
if "$ref" in schema: validate_schema(resolve_ref(schema), depth+1)

Additional Checks:

  • Kubernetes Audit Logs:
    kubectl logs -l app=helm --tail=100 | grep -i "stack overflow"
    
  • Resource Limits:
    ulimit -s 8192 Set stack size limit
    

References:

References:

Reported By: https://github.com/advisories/GHSA-5xqw-8hwv-wg92
Extra Source Hub:
Undercode

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image

Scroll to Top