Has leveraged malware capable of execution via the Linux CLI.1
Unix Shell T1059.004
- Tactic
- Execution
- Platforms
- ESXi, Linux, macOS, Network Devices
- Version
- 1.4
- Created
- 09 March 2020
- Last modified
- 12 May 2026
Adversaries may abuse Unix shell commands and scripts for execution. Unix shells are the primary command prompt on Linux, macOS, and ESXi systems, though many variations of the Unix shell exist (e.g. sh, ash, bash, zsh, etc.) depending on the specific OS or distribution.[1][2] Unix shells can control every aspect of a system, with certain commands requiring elevated privileges.
Unix Shell MITRE reference T1059.004
11 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 targeted macOS victim hosts using a bash downloader coremedia.sh and a bash script cloud.sh.1
Has used a bash script to install malicious vSphere Installation Bundles (VIBs).1
Used a custom tool, VELVETSTING, to parse encoded inbound commands to compromised F5 BIG-IP devices and then execute them via the Unix shell.1
Used shell scripts for post-exploitation execution in victim environments.12
Has used Brightmetricagent.exe which contains a command- line interface (CLI) library that can leverage command shells including Z Shell (zsh).1
All 11 groups for this technique · 6 newest in this preview
6 campaigns have been recorded using this technique. Listed newest first; dates are year-granularity and attribution is MITRE’s.
During the 2025 Poland Wiper Attacks, the adversaries utilized the Linux dd command to overwrite portions of the disks with random data.1
During RedPenguin, UNC3886 used malware capable of launching an interactive shell.12
During Operation MidnightEclipse, threat actors piped output from stdout to bash for execution.12
Has enabled the creation of an access-controlled command shell /bin/sh on compromised routers.12
Utilizes multiple Bash scripts during botnet installation stages, and the final botnet payload allows for running commands in the Bash shell.1
Has executed multiple Bash controller scripts to provide command line inputs for FLORAHOX traversal configurations.1
All 6 campaigns for this technique
49 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 used shell commands to enable and start the malicious systemd service for execution and persistence.12
Has abused the shell script files entrypoint.sh (in trivy-action) and setup.sh (in ast-github-action/2.3.28) for discovery and credential harvesting.1 2
Has executed shell commands using /bin/sh.1
Has utilized Linux shell commands to modify configuration files.1
Has the ability to spawn BusyBox command shell in victim environments.1
Can execute commands with /bin/sh.1
All 49 software entries for this technique · 6 newest in this preview
Offense vs defense T1059.004
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.
Unix Shell detection strategy DET0384
MITRE names one behaviour worth catching for this technique and breaks it into 4 analytics, one per platform. Each carries the log sources it needs and the fields you tune per environment.
Behavioral Detection of Unix Shell Execution
AN1081 · Linux
Detects bash, sh, zsh, or BusyBox shell execution initiated via remote sessions, unauthorized users, or embedded within secondary script interpreters. Focus is on chained behavior: shell > suspicious commands > network discovery or persistence indicators.
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 |
| Logon Session CreationDC0067 | linux:syslog | auth.log / secure.log |
| Network Traffic FlowDC0078 | linux:osquery | socket_events |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| ExecutableName | Detect variants like /bin/sh, /usr/local/bin/zsh, /bin/busybox sh. |
| UserContext | Shell used by service accounts, root, or rare accounts. |
| ParentProcess | Shell invoked by unexpected parents (e.g., curl, mail, apache2). |
| TimeWindow | Execution outside maintenance windows or normal activity periods. |
| CommandLinePattern | Flags use of loops, download commands, chaining (|, &&), or reverse shells. |
AN1082 · macOS
Identifies use of sh/bash/zsh in suspicious context, such as user scripts launched from non-standard apps (e.g., Preview.app), embedded in LaunchDaemons, or executed outside Terminal.app. Looks for misuse in Automator, LaunchAgents, or NSAppleScript-executed shell.
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 |
|---|---|---|
| Script ExecutionDC0029 | macos:syslog | system.log, asl.log |
| Process CreationDC0032 | macos:unifiedlog | log stream --predicate 'eventMessage contains "exec"' |
| Command ExecutionDC0064 | macos:osquery | launchd + process_events |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| ScriptLocation | Execution from /Users/Shared, ~/Library/LaunchAgents, /tmp. |
| ParentProcess | Shells spawned from Preview, Safari, or AppleScript. |
| UserRole | Detection thresholds may differ for admin vs standard users. |
AN1083 · ESXi
Detects BusyBox or Ash shell execution from unauthorized logins or remote connections. Focus is on rare shell invocations from DCUI, SSH sessions, or remote management paths. Also watches for payload droppers or persistence artifacts using shell.
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:vmkernel | DCUI shell start, BusyBox activity |
| Logon Session CreationDC0067 | esxi:auth | Shell login or escalation |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| UserContext | Non-root use of shell (or root outside maintenance window). |
| CommandPattern | Use of ‘nc’, ‘wget’, or dropper-like behavior in shell. |
| ShellPath | Unexpected invocation of BusyBox/ash from mounted ISO or datastore. |
AN1084 · Network Devices
Detects Unix shell usage on network appliances (e.g., routers, firewalls, embedded Linux) through rare console commands, CLI interfaces, or script injection via exposed APIs 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 |
|---|---|---|
| Command ExecutionDC0064 | networkdevice:syslog | CLI Command Audit |
| Network Connection CreationDC0082 | NSM:Flow | remote access |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| Interface | Flags command line access via remote console (telnet/SSH/API) from non-whitelisted source. |
| CommandString | Monitors rare/privileged shell commands (e.g., enable, tftp, firmware mod). |
Use application control where appropriate. On ESXi hosts, the execInstalledOnly feature prevents binaries from being run unless they have been packaged and signed as part of a vSphere installation bundle (VIB).
Tests from Atomic Red Team (MIT licence) · technique definition