Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Adversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-09 | ✗→✓ | ▲ Improved | 80% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 103% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 252% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 150% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 391% | 0% |
> Sub-technique of: T1053
Adversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension <code>.timer</code> that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. They can be used as an alternative to Cron in Linux environments. Systemd timers may be activated remotely via the <code>systemctl</code> command line utility, which operates over SSH.
Each <code>.timer</code> file must have a corresponding <code>.service</code> file with the same name, e.g., <code>example.timer</code> and <code>example.service</code>. <code>.service</code> files are Systemd Service unit files that are managed by the systemd system and service manager. Privileged timers are written to <code>/etc/systemd/system/</code> and <code>/usr/lib/systemd/system</code> while user level are written to <code>~/.config/systemd/user/</code>.
An adversary may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence. Timers installed using privileged paths may be used to maintain root level persistence. Adversaries may also install user level timers to achieve user level persistence.
Platforms: Linux
The following tests are from Atomic Red Team and provide actionable ways to test this technique:
This test creates Systemd service and timer then starts and enables the Systemd timer
Supported Platforms: linux Elevation Required: Yes
bashecho "[Unit]" > #{path_to_systemd_service} echo "Description=Atomic Red Team Systemd Timer Service" >> #{path_to_systemd_service} echo "[Service]" >> #{path_to_systemd_service} echo "Type=simple" >> #{path_to_systemd_service} echo "ExecStart=/bin/touch /tmp/art-systemd-timer-marker" >> #{path_to_systemd_service} echo "[Install]" >> #{path_to_systemd_service} echo "WantedBy=multi-user.target" >> #{path_to_systemd_service} echo "[Unit]" > #{path_to_systemd_timer} echo "Description=Executes Atomic Red Team Systemd Timer Service" >> #{path_to_systemd_timer} echo "Requires=#{systemd_service_name}" >> #{path_to_systemd_timer} echo "[Timer]" >> #{path_to_systemd_timer} echo "Unit=#{systemd_service_name}" >> #{path_to_systemd_timer} echo "OnCalendar=*-*-* *:*:00" >> #{path_to_systemd_timer} echo "[Install]" >> #{path_to_systemd_timer} echo "WantedBy=timers.target" >> #{path_to_systemd_timer} systemctl start #{systemd_timer_name} systemctl enable #{systemd_timer_name} systemctl daemon-reload
Schedule a user level transient task (will not survive a reboot) without having to create the .timer or .service files by using the systemd-run command.
Supported Platforms: linux
bashsystemd-run --user --unit=Atomic-Red-Team --on-calendar '*:0/1' /bin/sh -c 'echo "$(date) $(whoami)" >>/tmp/log'
Dependencies:
Schedule a system level transient task (will not survive a reboot) without having to create the .timer or .service files by using the systemd-run command.
Supported Platforms: linux Elevation Required: Yes
bashsystemd-run --unit=Atomic-Red-Team --on-calendar '*:0/1' /bin/sh -c 'echo "$(date) $(whoami)" >>/tmp/log'
Dependencies:
If Atomic Red Team tests are not applicable, manually verify the technique by:
Restrict read/write access to systemd <code>.timer</code> unit files to only select privileged users who have a legitimate need to manage system services.
Limit user access to system utilities such as 'systemctl' or 'systemd-run' to users who have a legitimate need.
Limit access to the root account and prevent users from creating and/or modifying systemd timer unit files.
| Finding | Severity | Impact | | ----------------------------------- | -------- | --------- | | Systemd Timers technique applicable | High | Execution |
| CWE ID | Title | | ------ | -------------------------------------- | | CWE-94 | Improper Control of Generation of Code |
Other measured skills in the registry, with their headline benchmark lift.