RC Scripts

T1037.004

Sub-technique of T1037 Boot or Logon Initialization Scripts.View on attack.mitre.org

About this technique

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. 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. 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.

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. This technique can be used on Mac OS X Panther v10.3 and earlier versions which still execute the RC scripts. To maintain backwards compatibility some systems, such as Ubuntu, will execute the RC scripts if they exist with the correct file permissions.

Detection rules1

Rules on DetectionCode tagged with T1037.004.

Sigma0

No Sigma rules are mapped to this technique yet.

Splunk1

RuleTypeRiskData source
Linux File Creation In Init Boot DirectoryAnomalyNULLSysmon for Linux EventID 11

Groups3

Software4

Campaigns0

None recorded.

Procedure examples7

Groups3

Used byProcedure example
GroupAPT29

APT29 has installed a run command on a compromised system to enable malware execution on system startup.

GroupUNC3886

UNC3886 has placed a bash installation script into `/etc/rc.local.d/` to establish persistence.

GroupVelvet Ant

Velvet Ant used a modified `/etc/rc.local` file on compromised F5 BIG-IP devices to maintain persistence.

Software4

Used byProcedure example
MalwareCyclops Blink

Cyclops Blink has the ability to execute on device startup, using a modified RC script named S51armled.

MalwareGreen Lambert

Green Lambert can add init.d and rc.d files in the /etc folder to establish persistence.

MalwareHiddenWasp

HiddenWasp installs reboot persistence by adding itself to /etc/rc.local.

MalwareiKitten

iKitten adds an entry to the rc.common file for persistence.

References8

  1. Apple Developer Doco Archive Launchd Open source
    Apple. (2016, September 13). Daemons and Services Programming Guide - Creating Launch Daemons and Agents. Retrieved February 24, 2021.
  2. Intezer HiddenWasp Map 2019 Open source
    Sanmillan, I. (2019, May 29). HiddenWasp Malware Stings Targeted Linux Systems. Retrieved June 24, 2019.
  3. IranThreats Kittens Dec 2017 Open source
    Iran Threats . (2017, December 5). Flying Kitten to Rocket Kitten, A Case of Ambiguity and Shared Code. Retrieved May 28, 2020.
  4. Juniper Networks ESXi Backdoor 2022 Open source
    Asher Langton. (2022, December 9). A Custom Python Backdoor for VMWare ESXi Servers. Retrieved March 26, 2025.
  5. Methods of Mac Malware Persistence Open source
    Patrick Wardle. (2014, September). Methods of Malware Persistence on Mac OS X. Retrieved July 5, 2017.
  6. Startup Items Open source
    Apple. (2016, September 13). Startup Items. Retrieved July 11, 2017.
  7. Ubuntu Manpage systemd rc Open source
    Canonical Ltd.. (n.d.). systemd-rc-local-generator - Compatibility generator for starting /etc/rc.local and /usr/sbin/halt.local during boot and shutdown. Retrieved February 23, 2021.
  8. intezer-kaiji-malware Open source
    Paul Litvak. (2020, May 4). Kaiji: New Chinese Linux malware turning to Golang. Retrieved December 17, 2020.

Data from MITRE ATT&CK® (Enterprise). ATT&CK® is a registered trademark of The MITRE Corporation.