Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Adversaries may abuse the Windows command shell for execution.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 80% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 7% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 74% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 1% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 43% | 0% |
> Sub-technique of: T1059
Adversaries may abuse the Windows command shell for execution. The Windows command shell (cmd) is the primary command prompt on Windows systems. The Windows command prompt can be used to control almost any aspect of a system, with various permission levels required for different subsets of commands. The command prompt can be invoked remotely via Remote Services such as SSH.
Batch files (ex: .bat or .cmd) also provide the shell with a list of sequential commands to run, as well as normal scripting operations such as conditionals and loops. Common uses of batch files include long or repetitive tasks, or the need to run the same set of commands on multiple systems.
Adversaries may leverage cmd to execute various commands and payloads. Common uses include cmd to execute a single command, or abusing cmd interactively with input and output forwarded over a command and control channel.
Platforms: Windows
The following tests are from Atomic Red Team and provide actionable ways to test this technique:
Creates and executes a simple batch script. Upon execution, CMD will briefly launch to run the batch script then close again.
Supported Platforms: windows
powershellStart-Process "#{script_path}"
Dependencies:
Writes text to a file and display the results. This test is intended to emulate the dropping of a malicious file to disk.
Supported Platforms: windows
cmdecho "#{message}" > "#{file_contents_path}" & type "#{file_contents_path}"
Command line executed via suspicious invocation. Example is from the 2021 Threat Detection Report by Red Canary.
Supported Platforms: windows
cmd%LOCALAPPDATA:~-3,1%md /c echo #{input_message} > #{output_file} & type #{output_file}
This test attempts to open a file a specified number of times in Wordpad, then prints the contents. It is designed to mimic BlackByte ransomware's print bombing technique, where tree.dll, which contains the ransom note, is opened in Wordpad 75 times and then printed. See https://redcanary.com/blog/blackbyte-ransomware/.
Supported Platforms: windows
powershellcmd /c "for /l %x in (1,1,#{max_to_print}) do start wordpad.exe /p #{file_to_print}" | out-null
Dependencies:
Simulate Raspberry Robin using the "standard-in" command prompt feature cmd /R < to read and execute a file via cmd.exe See https://redcanary.com/blog/raspberry-robin/.
Supported Platforms: windows
cmdcmd /r cmd<"#{input_file}"
Dependencies:
If Atomic Red Team tests are not applicable, manually verify the technique by:
Use application control where appropriate.
| Finding | Severity | Impact | | ------------------------------------------ | -------- | --------- | | Windows Command Shell technique applicable | Low | Execution |
| CWE ID | Title | | ------ | -------------------------------------- | | CWE-94 | Improper Control of Generation of Code |
Other measured skills in the registry, with their headline benchmark lift.