MITRE ATT&CKsub-technique
T1037.004 RC Scripts
- Domain
- enterprise
- Tactics
- Persistence, Privilege Escalation
- Platforms
- macOS, Linux, Network Devices, ESXi
- Version
- 2.2
- Created
- 2020-01-15
Description
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.
Related
Subtechnique of · MITRE ATT&CK (1)
- T1037 Boot or Logon Initialization Scripts technique
Referenced by MITRE ATT&CK · mitigates (1)
- M1022 Restrict File and Directory Permissions mitigation
Referenced by MITRE ATT&CK · uses (9)
Referenced by Compliance · mitigates (7)
- NIST-AC-3 Access Enforcement NIST 800-53 control
- NIST-CA-7 Continuous Monitoring NIST 800-53 control
- NIST-CM-2 Baseline Configuration NIST 800-53 control
- NIST-CM-6 Configuration Settings NIST 800-53 control
- NIST-SI-3 Malicious Code Protection NIST 800-53 control
- NIST-SI-4 System Monitoring NIST 800-53 control
- NIST-SI-7 Software, Firmware, and Information Integrity NIST 800-53 control
References
- https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html Apple Developer Doco Archive Launchd
- https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/StartupItems.html Startup Items
- https://blogs.juniper.net/en-us/threat-research/a-custom-python-backdoor-for-vmware-esxi-servers Juniper Networks ESXi Backdoor 2022
- http://manpages.ubuntu.com/manpages/bionic/man8/systemd-rc-local-generator.8.html Ubuntu Manpage systemd rc
- https://iranthreats.github.io/resources/attribution-flying-rocket-kitten/ IranThreats Kittens Dec 2017
- https://www.virusbulletin.com/uploads/pdf/conference/vb2014/VB2014-Wardle.pdf Methods of Mac Malware Persistence
- https://www.intezer.com/blog/research/kaiji-new-chinese-linux-malware-turning-to-golang/ intezer-kaiji-malware
- https://www.intezer.com/blog-hiddenwasp-malware-targeting-linux-systems/ Intezer HiddenWasp Map 2019