MITRE ATT&CK / Techniques / T1037.004

Boot or Logon Initialization Scripts: RC Scripts

ID
T1037.004
Tactics
TA0003 Persistence, TA0004 Privilege Escalation
Sub-technique of
T1037 Boot or Logon Initialization Scripts
Platforms
macOS, Linux, Network Devices, ESXi
Data sources
Process Creation, Script Execution, File Creation, Command Execution, File Modification
Source
attack.mitre.org
MITRE last modified
25 Oct 2025

Adversaries may establish persistence by modifying RC scripts, which are executed during a Unix-like system’s startup. These files allow system administrators to map and start custom services at startup for different run levels. RC scripts require root privileges to modify.

Adversaries may establish persistence by adding a malicious binary path or shell commands to rc.local, rc.common, and other RC scripts specific to the Unix-like distribution.[1][2] Upon reboot, the system executes the script's contents as root, resulting in persistence.

Adversary abuse of RC scripts is especially effective for lightweight Unix-like distributions using the root user as default, such as ESXi hypervisors, IoT, or embedded systems.[3] As ESXi servers store most system files in memory and therefore discard changes on shutdown, leveraging /etc/rc.local.d/local.sh is one of the few mechanisms for enabling persistence across reboots.[4]

Several Unix-like systems have moved to Systemd and deprecated the use of RC scripts. This is now a deprecated mechanism in macOS in favor of Launchd.[5][6] This technique can be used on Mac OS X Panther v10.3 and earlier versions which still execute the RC scripts.[7] To maintain backwards compatibility some systems, such as Ubuntu, will execute the RC scripts if they exist with the correct file permissions.[8]

Detection

Mitigations (1)

M1022 Restrict File and Directory Permissions

Limit privileges of user accounts so only authorized users can edit the rc.common file.

Groups (3)

Software (6)

References

  1. IranThreats Kittens Dec 2017
  2. Intezer HiddenWasp Map 2019
  3. intezer-kaiji-malware
  4. Juniper Networks ESXi Backdoor 2022
  5. Apple Developer Doco Archive Launchd
  6. Startup Items
  7. Methods of Mac Malware Persistence
  8. Ubuntu Manpage systemd rc