DET-069 · human · confidence High
Linux Clock Change Audit Rule
Add an auditd rule that records every attempt to set or adjust the system clock.
Changing the clock can scramble log order and make a timeline unreliable. On Linux, the auditd system can watch the system calls that change time: adjtimex, settimeofday and clock_settime. It covers tools such as date, timedatectl, hwclock and chrony, as well as custom code, because they all end up in those calls.
Add rules for 64-bit and, where supported, 32-bit programs, tag them with a key, and search by key later. Forward the audit log off the host so the person cannot erase it.
- Data sources
- auditd logsLinux syslog forwarder
- Platforms
- Linux
Logic
Rules in /etc/audit/rules.d/time.rules: -a always,exit -F arch=b64 -S adjtimex,settimeofday,clock_settime -k system-time-changed -a always,exit -F arch=b32 -S adjtimex,settimeofday,clock_settime,stime -k system-time-changed Then: ausearch -k system-time-changed -i
False positives
chrony or ntpd small adjustments will appear. Filter for the daemon's executable and for large offsets.