← All Threat Hunting ReportsThreat Hunting Exercise

Threat Hunting Exercise: Analyzing Linux Init.d/RC.local Legacy Persistence Dataset

This hunt uses a simulated Linux auditd dataset (linux_rclocal_persist_2022-12-02T023000.json) capturing T1037.004: Boot or Logon Initialization Scripts: RC Scripts, where an attacker appends a malicious command to /etc/rc.local or drops a script into /etc/init.d/, relying on legacy SysV-init compatibility layers still present on many modern Linux distributions to achieve boot persistence.

Step 1: Hypothesis Formation

Hypothesis: The /etc/rc.local file is modified to append a command referencing a suspicious binary/script path, or a new script is added to /etc/init.d/ with a corresponding update-rc.d/chkconfig registration, by a process other than the system's package manager or configuration-management agent, indicating legacy boot-script abuse for persistence. Indicators:

Null Hypothesis: A system administrator is legitimately configuring a legacy service for compatibility reasons, or a configuration-management tool is deploying an approved rc.local entry as documented in the server build standard. Invalidate by checking source of the modifying process against the CM agent and any documented server-hardening/build exceptions.

Rationale: Even though systemd has largely replaced SysV-init, most modern distributions retain rc.local/init.d execution for backward compatibility, and because these paths are rarely monitored as closely as systemd units, they remain an effective, lower-visibility persistence mechanism that only file-integrity monitoring on legacy boot paths will reliably catch.

Step 2: Data Sources and Scope

Step 3: Key Findings

Parsed events (4 shown) confirm an attacker appended a reverse-shell invocation to /etc/rc.local on a database server, disguising it among the file's existing legitimate startup commands.

Timestamp (UTC)HostEventDetailIOC/Why Suspicious?
2022-12-02 02:30:11SVR-DB-08auditd (execve)echo "/bin/bash -c '/var/tmp/.x/upd.sh &' " >> /etc/rc.local, run by mysql service accountAnomalous-Writer IOC: the MySQL service account has no legitimate reason to modify system boot scripts; this indicates the account was compromised via a SQL-injection-to-OS-command escalation.
2022-12-02 02:30:11SVR-DB-08(File content diff)New line appended before the file's final exit 0, referencing /var/tmp/.x/upd.shPath-Anomaly IOC: the referenced script resides in a world-writable temp directory under a hidden .x folder, not any standard application installation path.
2022-12-02 02:30:14SVR-DB-08auditd (execve)chmod +x /var/tmp/.x/upd.shPreparation IOC: making the dropped script executable immediately after the rc.local append completes the persistence chain, ensuring it runs with root privileges at next boot (rc.local executes as root by default).
--(Package-transaction correlation)No dpkg/rpm transaction is logged for SVR-DB-08 in this windowConfirms this modification did not originate from any legitimate software installation or update process.

Validation:

Step 4: Recommendations & Next Steps

Hypothesis confirmed - a compromised MySQL service account appended a reverse-shell-launching command to /etc/rc.local and staged the referenced script for root-level execution at the next system reboot!