CVE 2023 38831 Winrar Spawning Cmd
Query
DeviceProcessEvents
| where InitiatingProcessParentFileName has @"winrar.exe"
| where InitiatingProcessFileName has @"cmd.exe"
| project Timestamp, DeviceName, FileName, FolderPath, ProcessCommandLine, AccountName
| sort by Timestamp descAbout this query
CVE-2023-38831 WinRAR spawning CMD
Description
If you are using a RARLabs WinRAR version prior to 6.23, you are vulnerable to CVE-2023-38831 which allows RCE. A benign file like PDF or JPG could facilitate the execution of arbitrary code.
References
Microsoft 365 Defender & Microsoft Sentinel
MITRE ATT&CK Mapping
- Tactic: Execution
- Technique ID: T1059.003
- Command and Scripting Interpreter: Windows Command Shell
Source
MDE, however if you have ASR enabled you will be able to detect this activity as suspicious.
Versioning
| Version | Date | Comments |
|---|---|---|
| 1.0 | 10/09/2023 | Initial publish |
Explanation
This query is designed to identify potential security threats related to a vulnerability in older versions of WinRAR (prior to version 6.23). The vulnerability, known as CVE-2023-38831, allows for remote code execution (RCE), meaning that an attacker could potentially run malicious code on a victim's computer by tricking them into opening a seemingly harmless file, like a PDF or JPG.
The query is specifically looking for instances where WinRAR (winrar.exe) is used to start the Windows Command Prompt (cmd.exe). This behavior is suspicious because it could indicate that someone is exploiting the vulnerability to execute commands on the system.
The query is run on data from Microsoft 365 Defender and Microsoft Sentinel, focusing on events where a process initiated by WinRAR leads to the execution of the command shell. It captures details such as the time of the event, the device name, file name, folder path, command line used, and the account name associated with the activity. The results are sorted by the most recent events.
This activity is mapped to the MITRE ATT&CK framework under the Execution tactic, specifically the technique for using the Windows Command Shell (T1059.003).
The query is part of a security monitoring effort to detect and respond to potential exploitation of this vulnerability. If Attack Surface Reduction (ASR) rules are enabled, this activity can be flagged as suspicious, providing an additional layer of security.