Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Adversaries may abuse command and script interpreters to execute commands, scripts, or binaries.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-10 | ✗→✓ | ▲ Improved | 41% | 0% |
| case-13 | ✗→✓ | ▲ Improved | -37% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 55% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 12% | 0% |
| case-11 | ✓→✓ | = Same ✓ | -9% | 0% |
Adversaries may abuse command and script interpreters to execute commands, scripts, or binaries. These interfaces and languages provide ways of interacting with computer systems and are a common feature across many different platforms. Most systems come with some built-in command-line interface and scripting capabilities, for example, macOS and Linux distributions include some flavor of Unix Shell while Windows installations include the Windows Command Shell and PowerShell.
There are also cross-platform interpreters such as Python, as well as those commonly associated with client applications such as JavaScript and Visual Basic.
Adversaries may abuse these technologies in various ways as a means of executing arbitrary commands. Commands and scripts can be embedded in Initial Access payloads delivered to victims as lure documents or as secondary payloads downloaded from an existing C2. Adversaries may also execute commands through interactive terminals/shells, as well as utilize various Remote Services in order to achieve remote Execution.
Platforms: ESXi, IaaS, Identity Provider, Linux, macOS, Network Devices, Office Suite, Windows
The following tests are from Atomic Red Team and provide actionable ways to test this technique:
An adversary may attempt to execute suspicious or malicious script using AutoIt software instead of regular terminal like powershell or cmd. Calculator will popup when the script is executed successfully.
Supported Platforms: windows
powershellStart-Process -FilePath "#{autoit_path}" -ArgumentList "#{script_path}"
Dependencies:
If Atomic Red Team tests are not applicable, manually verify the technique by:
Prevent user installation of unrequired command and scripting interpreters.
Where possible, only permit execution of signed scripts.
Disable or remove any unnecessary or unused shells or interpreters.
Use application control where appropriate. For example, PowerShell Constrained Language mode can be used to restrict access to sensitive or otherwise dangerous language elements such as those used to execute arbitrary Windows APIs or files (e.g., Add-Type).
Anti-virus can be used to automatically quarantine suspicious files.
When PowerShell is necessary, consider restricting PowerShell execution policy to administrators. Be aware that there are methods of bypassing the PowerShell execution policy, depending on environment configuration.
PowerShell JEA (Just Enough Administration) may also be used to sandbox administration and limit what commands admins/users can execute through remote PowerShell sessions.
Inventory systems for unauthorized command and scripting interpreter installations.
Script blocking extensions can help prevent the execution of scripts and HTA files that may commonly be used during the exploitation process. For malicious code served up through ads, adblockers can help prevent that code from executing in the first place.
On Windows 10, enable Attack Surface Reduction (ASR) rules to prevent Visual Basic and JavaScript scripts from executing potentially malicious downloaded content .
| Finding | Severity | Impact | | ------------------------------------------------------ | -------- | --------- | | Command and Scripting Interpreter 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.