Skip to content

Linux persistence techniques

Every place on a Linux system that makes code run again: what reads it and when, where it lives, how intruders abuse it, and how to check a host. Each page maps to MITRE ATT&CK and to what the Linux Persistence tool flags.

By when it fires

At boot

On a schedule

At login

Each new shell

At SSH login

At authentication

Privilege

On an event

On network change

On package install

Every program start

Cheat sheet

One line per technique: when it runs, who can set it up, the main locations and the ATT&CK mapping.

TechniqueRunsSet up byMain locationsATT&CK
At jobsOn a scheduleUsers and root/var/spool/cron/atjobs/* · /var/spool/at/* · /etc/at.allow · /etc/at.denyT1053.002
Cron jobsOn a scheduleUsers and root/etc/crontab · /etc/cron.d/* · /etc/cron.hourly/* · /etc/cron.daily/*T1053.003
History tamperingEach new shellUsers and root~/.bash_history · ~/.zsh_history · /root/.bash_history · ~/.bashrcT1070.003
Kernel modulesAt bootroot/etc/modules · /etc/modules-load.d/*.conf · /etc/modprobe.d/*.conf · /usr/lib/modules-load.d/*.confT1547.006
LD_PRELOAD / ld.so.preloadEvery program startUsers and root/etc/ld.so.preload · /etc/ld.so.conf · /etc/ld.so.conf.d/*.conf · /etc/environmentT1574.006
Local accountsAt loginroot/etc/passwd · /etc/shadow · /etc/group · /etc/gshadowT1136.001, T1078.003
Logrotate scriptsOn a scheduleroot/etc/logrotate.conf · /etc/logrotate.d/*—
MOTD scriptsAt loginroot/etc/update-motd.d/* · /etc/pam.d/sshd · /etc/pam.d/login · /run/motd.dynamic—
Network hooksOn network changeroot/etc/NetworkManager/dispatcher.d/* · /etc/network/if-up.d/* · /etc/network/if-pre-up.d/* · /etc/ppp/ip-up.d/*—
Package manager hooksOn package installroot/etc/apt/apt.conf.d/* · /etc/dpkg/dpkg.cfg.d/* · /etc/dnf/plugins/*.conf · /etc/yum/pluginconf.d/*.confT1546.016
PAM backdoorsAt authenticationroot/etc/pam.d/* · /etc/pam.conf · /usr/share/pam-configs/* · /usr/lib/x86_64-linux-gnu/security/*.soT1556.003
rc.localAt bootroot/etc/rc.local · /etc/rc.d/rc.local · /usr/lib/systemd/system/rc-local.serviceT1037.004
Shell startup filesEach new shellUsers and root/etc/profile · /etc/profile.d/*.sh · /etc/bash.bashrc · /etc/bashrcT1546.004
SSH authorized keysAt SSH loginUsers and root~/.ssh/authorized_keys · ~/.ssh/authorized_keys2 · /root/.ssh/authorized_keys · ~/.ssh/rcT1098.004
sshd configurationAt SSH loginroot/etc/ssh/sshd_config · /etc/ssh/sshd_config.d/*.conf · /etc/ssh/sshrc · /etc/default/sshT1098.004
Sudoers rulesPrivilegeroot/etc/sudoers · /etc/sudoers.d/* · /etc/sudo.confT1548.003
systemd generatorsAt bootroot/etc/systemd/system-generators/* · /usr/local/lib/systemd/system-generators/* · /usr/lib/systemd/system-generators/* · /run/systemd/system-generators/*T1543.002
systemd servicesAt bootUsers and root/etc/systemd/system/* · /etc/systemd/system/<unit>.d/*.conf · /usr/lib/systemd/system/* · /usr/local/lib/systemd/system/*T1543.002
systemd timersOn a scheduleUsers and root/etc/systemd/system/*.timer · /etc/systemd/system/timers.target.wants/* · /usr/lib/systemd/system/*.timer · ~/.config/systemd/user/*.timerT1053.006
SysV init scriptsAt bootroot/etc/init.d/* · /etc/rc[0-6S].d/* · /etc/rc.d/init.d/* · /etc/rc.d/rc[0-6].d/*T1037.004
udev rulesOn an eventroot/etc/udev/rules.d/*.rules · /run/udev/rules.d/*.rules · /usr/lib/udev/rules.d/*.rules · /lib/udev/rules.d/*.rulesT1546.017
XDG autostartAt loginUsers and root/etc/xdg/autostart/*.desktop · ~/.config/autostart/*.desktopT1547.013

MITRE ATT&CK coverage

The ATT&CK techniques these pages and the tool cover. Some mechanisms have no sub-technique of their own and are listed under the closest parent.