CyberKit

cron and systemd Timers

Also called crontab, anacron, .timer units, scheduled tasks.

Time-based job schedulers on Unix and a classic persistence and execution vector.

What it is

Mechanisms that run commands on a schedule: classic cron (per-user crontabs plus /etc/crontab, /etc/cron.d, and the cron.daily/weekly/monthly directories), anacron for missed jobs on machines that aren't always on, and systemd .timer units that trigger service units. Each defines a schedule and a command or unit to run.

Where it lives

/etc/crontab, /etc/cron.d/, per-user crontabs under /var/spool/cron/ (path varies by distro); systemd timers under /etc/systemd/system/

Why it matters

Attackers plant cron entries or timer units to re-establish access on a cadence, so enumerating every scheduling source (including obscure per-user crontabs and drop-in cron.d files) is core to persistence hunting. Execution logs in cron and the journal corroborate when a malicious job actually fired.

In practice

An innocuous-looking /etc/cron.d file ran a base64-decoded reverse shell every ten minutes, which the journal confirmed by the repeating spawn cadence.

What to look for

  • New crontab entries or files in /etc/cron.d running from tmp or home folders.
  • Timer units paired with unfamiliar service units.
  • Jobs that download and pipe to a shell.

Common mistake

Checking only root's crontab. Every user's crontab and the system cron folders need a look.

Use it in CyberKit

In the field

Well-known tools where this shows up on the job. They are listed to show the landscape, not as a recommendation.

  • osquery Open source

    Exposes Linux and macOS system state as SQL tables you can query.

  • Velociraptor Open source

    Collects Linux artifacts such as logs, cron and shell history at scale. Our notes.

  • Falco Open source

    Watches system calls at runtime and alerts on suspicious behavior.

  • Wazuh Open source

    Collects Linux logs and checks file integrity on each host.

Read next

Sources