Has targeted macOS victim hosts using a bash downloader coremedia.sh and a bash script cloud.sh.1
Unix Shell Configuration Modification T1546.004
- Tactics
- Persistence, Privilege Escalation
- Platforms
- Linux, macOS
- Version
- 2.2
- Created
- 24 January 2020
- Last modified
- 12 May 2026
- Contributors
- Robert Wilson; Tony Lambert, Red Canary
Adversaries may establish persistence through executing malicious commands triggered by a user’s shell. User Unix Shells execute several configuration scripts at different points throughout the session based on events. For example, when a user opens a command-line interface or remotely logs in (such as via SSH) a login shell is initiated. The login shell executes scripts from the system (/etc) and the user’s home directory (~/) to configure the environment. All login shells on a system use /etc/profile when initiated. These configuration scripts run at the permission level of their directory and are often used to set environment variables, create aliases, and customize the user’s environment. When the shell exits or terminates, additional shell scripts are executed to ensure the shell exits appropriately.
Unix Shell Configuration Modification MITRE reference T1546.004
1 group has 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.
All 1 groups for this technique
1 campaign has been recorded using this technique. Listed newest first; dates are year-granularity and attribution is MITRE’s.
During ShadowRay, threat actors executed commands on interactive and reverse shells.1
All 1 campaigns for this technique
5 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 a bash script to modify components on Ivanti Connect Secure appliances and execute files via /bin/bash.[1] It has also used the Linux stream editor (sed) to execute commands.1
When executing with non-root level permissions, RotaJakiro can install persistence by adding a command to the .bashrc file that executes a binary in the ${HOME}/.gvfsd/.profile/ folder.1
Can establish persistence on a compromised host through modifying the profile, login, and run command (rc) files associated with the bash, csh, and tcsh shells. 12
Using AppleScript, XCSSET adds it's executable to the user's ~/.zshrc_aliases file ("echo " & payload & " > ~/zshrc_aliases"), it then adds a line to the .zshrc file to source the .zshrc_aliases file ([ -f $HOME/.zshrc_aliases ] && . $HOME/.zshrc_aliases). Each time the user starts a new zsh terminal session, the .zshrc file executes the .zshrc_aliases file.1
Maintains persistence on an infected machine through rc.local and .bashrc files. 1
All 5 software entries for this technique
Offense vs defense T1546.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 Configuration Modification detection strategy DET0020
MITRE names one behaviour worth catching for this technique and breaks it into 2 analytics, one per platform. Each carries the log sources it needs and the fields you tune per environment.
Detect Shell Configuration Modification for Persistence via Event-Triggered Execution
AN0059 · Linux
Detects modification of shell startup/logout scripts such as ~/.bashrc, ~/.bash_profile, or /etc/profile, followed by anomalous process execution or network connections upon interactive or remote shell login.
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:EXECVE | execution of unexpected binaries during user shell startup |
| File ModificationDC0061 | auditd:SYSCALL | AUDIT_SYSCALL (open, write, rename, unlink) |
| Network Traffic ContentDC0085 | NSM:Flow | unexpected network activity initiated shortly after shell session starts |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| TimeWindow | Defines how soon after shell startup process execution or network activity is considered suspicious. |
| TargetUser | Limits detection to specific user accounts or roles such as root or service accounts. |
| FilePathRegex | Defines what shell configuration paths are considered relevant (e.g., .bashrc, .bash_logout, etc.) |
AN0060 · macOS
Correlates zsh shell configuration file changes (e.g., ~/.zshrc, ~/.zlogin, /etc/zprofile) with execution of unauthorized binaries or unexpected network activity triggered on Terminal.app launch.
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 | launch of Terminal.app or shell with non-standard environment setup |
| File ModificationDC0061 | macos:endpointsecurity | ES_EVENT_TYPE_NOTIFY_WRITE, targeting .zshrc, .zlogin, .zprofile |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| FileTargetList | Customizable list of shell config files considered sensitive for detection. |
| PayloadEntropyThreshold | Used to distinguish benign from potentially obfuscated commands written to config files. |
| UserContext | Scoping based on user login class, e.g., administrative vs standard users. |
Making these files immutable and only changeable by certain administrators will limit the ability for adversaries to easily create user level persistence.
Tests from Atomic Red Team (MIT licence) · technique definition