Skip to main content

The Mindset

Processes and services matter to a pentester for three reasons:
  • Attack surface — Services running as root with known vulnerabilities
  • Credential exposure — Processes started with passwords as arguments (visible in ps)
  • Scheduled execution — Cron jobs and timers running privileged scripts you might be able to modify
Always ask: what is running, as whom, and can I influence it?

Processes

ps — Process Status

The primary tool for viewing running processes.
ps aux output explained:
Hunt for credentials in process arguments:
The first command searches ps aux output for common patterns used when passwords are passed as arguments — password/passwd as full argument names, --pass as a CLI flag, or -p followed by a number (common with database CLIs like mysql).The second command reads directly from /proc instead of ps. Every running process has a cmdline file in /proc/[PID]/ containing its full command line, but arguments are separated by null bytes (\0) instead of spaces. tr '\0' ' ' converts those null bytes to spaces so the output is readable, then grep filters for anything that looks like a secret.
Developers and sysadmins frequently pass database passwords as command-line arguments. These show up in ps aux and are readable by any user on the system.

Services (Daemons)

Services are background processes — identified by a d suffix in their name (sshd, httpd, mysqld). They’re managed by systemd on most modern Linux systems.

systemctl — Service Management

What to look for in service status:
Note the user context — if it says User=root in the unit file, any exploit against this service runs as root.

Check Service Unit Files for Misconfigs

journalctl — Service Logs


Listening Ports & Network Services

A service is only useful to you if it’s accessible. Map what’s listening and where.
Why this matters: Services listening on 127.0.0.1 (localhost only) are not exposed externally — but once you’re on the box, you can access them. Internal services are often less hardened than externally-facing ones.

Cron Jobs — Scheduled Task Abuse

Cron runs scripts on a schedule — often as root. If a root-owned cron job calls a script you can modify, you can inject commands that run as root.

Where Cron Jobs Live

Reading a Crontab

Exploiting Cron Jobs

Use pspy to monitor processes in real time without root — it catches cron jobs and other scheduled tasks as they execute, even ones not visible in crontab files. ./pspy64 — watch for root-owned processes spawning at regular intervals.

Systemd Timers — The Modern Cron

Systemd timers are the modern replacement for cron. Check them too.

Process Signals

Useful for controlling processes during a pentest — particularly for backgrounding tools or cleanly stopping them.

Background & Foreground


Next: Network Configuration & Enumeration — mapping the internal network, active connections, and pivoting opportunities.