Systemd timers are the modern replacement for cron jobs on many Linux systems. They offer more features and flexibility, but from a privilege escalation perspective, they present similar attack vectors to cron jobs.Related
Think of systemd timers as cron's fancy younger sibling. While cron is simple and straightforward, systemd timers come with more configuration options, dependencies, and complexity - which means more potential misconfigurations to exploit.
Modern Systems
Most modern Linux distributions (Ubuntu 16.04+, RHEL/CentOS 7+, Debian 8+) use systemd. If a system uses systemd, check both cron jobs AND systemd timers for scheduled tasks.
Understanding Systemd Timers
Enumerating Systemd Timers
Example Timer and Service
Writable Script Exploitation
Writable Service File
daemon-reload Required
After modifying .service files, systemd needs daemon-reload to see changes. This usually requires root or sudo. Changes might only take effect after reboot if you can't reload.
PATH Manipulation in Services
Creating Malicious Timers
User-Level Timers
Cron vs Systemd Timers
Check Both
Modern systems often have both cron and systemd timers. Don't assume all scheduled tasks are in cron. Always enumerate both to find all potential attack vectors.
Systemd Timer Methodology
Systemd Timer Exploitation Flow
1
List Timerssystemctl list-timers --all
2
Identify CustomLook for non-standard timer names
3
Read Servicesystemctl cat [name].service
4
Check ScriptVerify ExecStart script permissions
5
Check Service FileVerify .service file permissions
6
ExploitModify writable script or service
Knowledge Check
Challenges
Key Takeaways
- systemctl list-timers --all shows all scheduled tasks
- Timers need both .timer and .service files
- Check ExecStart scripts for writability
- Service files themselves may be writable
- daemon-reload required after modifying unit files
- Always check both cron AND systemd timers