How can Tanium help?
While it is not easy to determine if a specific executable calling cmd.exe is written in Rust, it is possible to baseline your environment for the behavior around cmd.exe child processes with command line parameters containing batch (*.bat) files. Tanium Threat Response customers can use a combination of questions and signals to understand and monitor the environment for potential exploitation attempts.
Command Line Analysis: Batch File Calls
For Tanium customers with Threat Response, the Trace Executed Processes sensor can assist in determining what in your environment calls batch files using cmd.exe. Per the vulnerability advisory and Rust’s documentation, the specific trigger to exploit this vulnerability is a call to cmd.exe with a *.bat file and unescaped arguments. Recorder would observe this as a parent process, something.exe, making a call to a child process of cmd.exe, and “.bat” within the command line.
Trace Executed Processes Sensor - Use the following sensor parameters, adjusting others (e.g. timeframe, output yes/no, etc) as necessary, to determine what applications and/or endpoints in your environment may be exhibiting this behavior.
-
Remove Endpoint Name, Username and Timestamps to stack results
-
Optionally set to Yes (Checked) for initial analysis
-
Older versions of this sensor labeled this parameter as “Make stackable / skip unique”
-
This allows you to see fewer columns in stacking format for ease of analysis
-
-
Treat Inputs as Regular Expressions
-
Yes (Checked)
-
-
Parent Process Path
-
.*(?<!TaniumClient\.exe)$
-
This helps ensure that the TaniumClient.exe, if recorded, is excluded from results
-
-
Process Path
-
.*cmd\.exe
-
This ensures we are looking at process creation events for calls to cmd.exe with *.bat in the command line per the vulnerability applicability conditions
-
-
Command Line
-
^(?!.*TPython\.bat).*\.bat*
-
This filters on command lines that contain the *.bat file, and excludes the TPython.bat file.
-
TPython.bat is located at C:\Program Files (x86)\Tanium\Tanium Client\TPython\TPython.bat
-
-
Sample Sensor Output
In the below sensor output, we have a three-day lookback, we are removing endpoint name/username/timestamps from results and have filtered TPython.bat and TaniumClient.exe from our results.
For this environment, VMware Tools are utilized and periodically runs *.bat files. A benign, version.bat, command was included to simulate an environmental specific result. There are two entries associated with main.exe, one is a true positive, simulated malicious execution of the CVE-2024-24576 vulnerability. There is also another entry that is intentionally benign using the same POC code. This type of output can assist in baselining calls to *.bat using cmd.exe with /c.
Example of POC Code with Malicious Input
The following screenshot shows the process tree and command line as observed by Tanium Recorder when executing the CVE-2024-24576 POC from https://github.com/frostb1ten/CVE-2024-24576-PoC.
Example Recorder Entries for Two Tests
Using the same POC code as linked above, two tests were run.
-
Green rows indicate a vulnerable rust POC code run with no malicious commands entered
-
Red rows indicate a vulnerable rust POC code run with malicious commands entered
Tanium Signals: Alert on Command Line Parameters and Filter using Process Ancestry
The behavior in CVE-2024-24576 could be alerted on with a Tanium Signal leveraging several process terms. The feasibility of this method of detection will vary from environment to environment. If your environment uses several applications that call batch files and/or a large volume of batch files, a Tanium signal may not be appropriate. Tanium Signals are limited to 55 unique terms, and we need at least two terms for the behavior.
The below signal uses the base behavior of cmd.exe with a command line containing *.bat. There are 3 additional terms, and these are exclusionary in nature based on the sensor results shown previously. Good candidates for exclusion terms are process parent or ancestry terms; this is demonstrated below with the parent_path ends with not ‘cmd.exe’ term.
Sample Signal Definition
process.path ends with 'cmd.exe' and process.command_line contains '.bat' and process.command_line contains NOT 'C:\\Program Files\\VMware\\VMware Tools\\resume-vm-default.bat' and process.parent_path ends with NOT 'cmd.exe'
This signal matched when using an On-demand Scan.
Developer Endpoints: Identifying Rust and Rust Versions
Endpoints used by developers that code in Rust are likely to have the Rust tools installed. There are several ways to install Rust, and depending on the method used, there is no singular way to identify the presence or absence of the tools and the associated versions if found.
Installed Applications Sensor
Default installations of Rust tools via rustup, which is the recommended method, install on a per-user basis. Rustup then will appear in Installed Applications for Windows endpoints, but it will not report the Rust tools version.
The Installed Applications sensor will identify the Rust tools version on a standalone, MSI-based installations of Rust, e.g. x86-64-pc-windows-msvc listed on the standalone installation methods page here.
A Tanium question similar to below can be used to identify endpoints with Rust associated tooling:
Get Installed Applications having Installed Applications:Name contains rust from all machines with Is Windows contains true
Index Sensors
Index sensors can provide a more robust detection method and help answer where Rust tooling may be installed across multiple operating systems.
In the below example, we are looking for the existence of rustc or rustc.exe in a path containing the string .rustup\toolchains (Windows) or .rustup/toolchains (Non-Windows). The .rustup and .cargo folders are created by rustup installer in the user’s home directory which can serve as a directory filter for the rustc file.
Get Index - File Exists[.*\.rustup\\toolchains*|.*\.rustup\/toolchains*,rustc|rustc.exe,*,*,*,*,*,*,1] from all machines
Endpoints with a “Yes” response should be examined to confirm the presence of Rust tooling and appropriate upgrades taken by the user(s).