Used XLM 4.0 macros for initial code execution for malicious document files.1
Command and Scripting Interpreter T1059
- Tactic
- Execution
- Platforms
- Containers, ESXi, IaaS, Identity Provider, Linux, macOS, Network Devices, Office Suite, SaaS, Windows
- Version
- 2.7
- Created
- 31 May 2017
- Last modified
- 12 May 2026
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.
Command and Scripting Interpreter MITRE reference T1059
17 groups have been recorded using this technique. Newest first; each entry carries MITRE’s procedure text and a link to the group’s full record. Click a name to filter the rules below.
Has used the Windows Script Host (wscript) to execute intermediate files written to victim machines.1
Has utilized meterpreter shellcode.1
Has used a Perl script for information gathering.1
Has used a Perl reverse shell to communicate with C2.1
Has used a simple remote shell tool that will call back to the C2 server and wait for commands.1
All 17 groups for this technique · 6 newest in this preview
4 campaigns have been recorded using this technique. Listed newest first; dates are year-granularity and attribution is MITRE’s.
During Cutting Edge, threat actors used Perl scripts to enable the deployment of the THINSPOOL shell script dropper and for enumerating host data.12
Included the adversary executing command line interface (CLI) commands.1
For Operation Spalax, the threat actors used Nullsoft Scriptable Install System (NSIS) scripts to install malware.1
Has executed PHP and Shell scripts to identify and infect subsequent routers for the ORB network.1
All 4 campaigns for this technique
23 software entries are documented implementing this technique. MITRE files each as a tool or as malware; newest first, then by how many groups carry them.
Has launched a reverse shell using a provided command line.1
Has used the command line for execution of commands.1
Has provided an arbitrary command execution interface.1
Was delivered as a Java Archive (JAR) that runs by attaching itself to the Apache Tomcat Java servlet and web server.1
Can receive command line arguments from an operator to corrupt the file system using the RawDisk driver.1
Variants can be delivered via highly obfuscated Windows Script Files (WSF) for initial execution.1
All 23 software entries for this technique · 6 newest in this preview
Offense vs defense T1059
Is defensive coverage keeping up with adversary use? Eight counts, each ranked against all 697 ATT&CK techniques. Attack sits left, defense right, so a shape leaning left means adversaries are better documented here than defenders are equipped. Hover any spoke for its percentile and the share of techniques that have more. The timeline below shows when each side arrived.
How it got here
Adversary activity (campaign spans) over cumulative rule output. Each source is plotted independently from zero, so neither line includes the other. Campaign dates are year-granularity.
Command and Scripting Interpreter detection strategy DET0516
MITRE names one behaviour worth catching for this technique and breaks it into 5 analytics, one per platform. Each carries the log sources it needs and the fields you tune per environment.
Behavioral Detection of Command and Scripting Interpreter Abuse
AN1428 · Windows
Detects the execution of scripting or command interpreters (e.g., powershell.exe, cmd.exe, wscript.exe) outside expected administrative time windows or from abnormal user contexts, often followed by encoded/obfuscated arguments or secondary execution events.
Log sources
The data this analytic draws on. You do not need every component — each one you already collect covers part of it. Each links to its ATT&CK record.
| Data component | Name | Channel |
|---|---|---|
| Process CreationDC0032 | WinEventLog:Sysmon | EventCode=1 |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| CommandLinePattern | Tunable to match encoded or uncommon script execution patterns specific to the environment. |
| ParentProcessName | May vary across managed/unmanaged workstations or user-driven script activity. |
| TimeWindow | Used to restrict analysis to work hours or known admin maintenance windows. |
AN1429 · Linux
Detects use of shell interpreters (e.g., bash, sh, python, perl) initiated by users or processes not normally executing them, especially when chaining suspicious utilities like netcat, curl, or ssh.
Log sources
The data this analytic draws on. You do not need every component — each one you already collect covers part of it. Each links to its ATT&CK record.
| Data component | Name | Channel |
|---|---|---|
| Process CreationDC0032 | auditd:SYSCALL | execve |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| InterpreterName | Regex to identify which interpreters (bash, python, ruby) to monitor based on typical usage. |
| UserContext | Scope to users or service accounts not expected to run interpreters interactively. |
| ExecutionChainLength | Defines maximum process tree depth to correlate interpreter execution with its effects. |
AN1430 · macOS
Detects launch of command-line interpreters via Terminal, Automator, or hidden osascript, especially when parent process lineage deviates from user-initiated applications.
Log sources
The data this analytic draws on. You do not need every component — each one you already collect covers part of it. Each links to its ATT&CK record.
| Data component | Name | Channel |
|---|---|---|
| Process CreationDC0032 | macos:unifiedlog | log stream --info --predicate 'eventMessage CONTAINS "exec"' |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| LaunchAgentName | Monitor for specific plist agents frequently abused for persistence or payload execution. |
| ScriptName | Path or script name pattern (e.g., hidden files, /tmp locations). |
| TerminalAppUsage | Adjust based on whether Terminal.app use is common or restricted in user policy. |
AN1431 · ESXi
Detects use of 'esxcli system' or direct interpreter commands (e.g., busybox shell) invoked from SSH or host terminal unexpectedly.
Log sources
The data this analytic draws on. You do not need every component — each one you already collect covers part of it. Each links to its ATT&CK record.
| Data component | Name | Channel |
|---|---|---|
| Command ExecutionDC0064 | esxi:vobd | shell session start |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| ShellEnabledFlag | Control alerting based on whether ESXi shell access is typically disabled. |
| SSHContext | Scope detection to SSH session origins or internal vs. remote access. |
AN1432 · Network Devices
Identifies CLI interpreter access (e.g., Cisco IOS, Juniper JUNOS) via enable mode or scripting-capable sessions used by uncommon accounts or from unknown IPs.
Log sources
The data this analytic draws on. You do not need every component — each one you already collect covers part of it. Each links to its ATT&CK record.
| Data component | Name | Channel |
|---|---|---|
| User Account AuthenticationDC0002 | networkdevice:syslog | authentication & authorization |
| Command ExecutionDC0064 | networkdevice:cli | shell command |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| UserRole | Which roles or privilege levels should be monitored for interpreter misuse. |
| DeviceType | Support filtering for routers, switches, firewalls depending on network segmentation. |
Often, after a threat actor gains access to a system, they will attempt to run some kind of malware to further infect the victim machine. These malware often have long command line strings, which could be a possible indicator of attack. Here, we use sysmon and Splunk to first find the average command string length and search for command strings that stretch over multiple lines, thus identifying anomalies and possibly malicious commands.
D3FEND techniques
The defensive countermeasure this analytic implements, in MITRE’s D3FEND ontology.
| ID | Name |
|---|---|
| D3-PSA | Process Spawn Analysis |
Data model references
The CAR data model objects, actions and fields the logic reads. Map these to your own schema before implementing.
| Object | Action | Field |
|---|---|---|
| process | create | command_line |
Implementations
Pseudocode is the canonical logic; the rest are CAR’s translations into vendor query languages.
This is a Splunk query that determines the average length of a command per user and searches for a command string that is multiple times longer than the average length
index=* sourcetype="xmlwineventlog" EventCode=4688 |eval cmd_len=len(CommandLine) | eventstats avg(cmd_len) as avg by host| stats max(cmd_len) as maxlen, values(avg) as avgperhost by host, CommandLine | where maxlen > 10*avgperhost
Anti-virus can be used to automatically quarantine suspicious files.
Inventory systems for unauthorized command and scripting interpreter installations.
On Windows 10, enable Attack Surface Reduction (ASR) rules to prevent Visual Basic and JavaScript scripts from executing potentially malicious downloaded content .
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).
Prevent user installation of unrequired command and scripting interpreters.
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.
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.
Tests from Atomic Red Team (MIT licence) · technique definition