Skip to Content
OpenVAPTAlpha
Pre-release. Academic, non-commercial, source-available code built by AI Cybersecurity Engineers. Free for your own use, 100% at your own risk. This website collects no data. Read MoreRead Less
Pre-release. OpenVAPT has no Stable release yet. Every build is an Alpha, Beta or Release Candidate: it may be incomplete or wrong, so use it only on test machines, 100% at your own risk. See Release Channels
Academic, non-commercial, source-available code built by AI Cybersecurity Engineers. These are AI systems, not people or registered engineers. Free for your own personal or business use, on your own machines, 100% at your own risk. Not for sale. Not for providing services. This website collects no data. Read the Acknowledgements
Pre-release. OpenVAPT has no Stable release yet. Every build is an Alpha, Beta or Release Candidate: it may be incomplete or wrong, so use it only on test machines, 100% at your own risk. See Release Channels
Academic, non-commercial, source-available code built by AI Cybersecurity Engineers. These are AI systems, not people or registered engineers. Free for your own personal or business use, on your own machines, 100% at your own risk. Not for sale. Not for providing services. This website collects no data. Read the Acknowledgements
P20PractitionerAbout 20 minutes

Secrets, Cron and Account Hygiene

The small cross-cutting habits that stop a low-privilege foothold becoming root. No secrets in readable files, restricted SSH keys, cron that runs only root-owned code, a clean PATH and consistent account files.

Read First: P7, P15

You Will Be Able To

  • Find secrets that any local user can read and explain why that is a lateral movement path.
  • Trace what a root cron job really executes and who could change it.
  • Spot account-file inconsistencies that tools such as pwck report.

Secret Sprawl

Secrets drift into configuration files, backups and .env files, and the file mode decides who else can use them. A password in a world-readable file under /etc or a web root is available to every website, service account and compromised process on the machine. OpenVAPT reads world-readable configuration-like files, within a fixed budget, for private key headers, cloud access key ids and password or token assignments. It reports only the file and the kind of match (HOST-SEC-001). The fix is two-fold: restrict the mode, and rotate the secret, because readable means leaked.

Keys and Options

A key in root's authorized_keys is a root password without an expiry date. OpenSSH lets each key carry options: from= limits the source addresses, command= pins the key to one program, and restrict turns off forwarding and PTYs. A root key with none of them, or an authorized_keys file others can write, is a quiet standing risk (HOST-SSH-013).

What Root Runs on Schedule

HOST-FS-005 protects the cron tables; the next question is what they run. A root job that executes /usr/local/bin/backup.sh is only as trustworthy as that file and its folder. If any user can edit or replace it, their code runs as root at the next run (HOST-CRON-001). Jobs that call a bare command name depend on PATH. A world-writable folder or a relative entry in cron's PATH lets anyone plant a program that root runs (HOST-CRON-002, MITRE ATT&CK T1574.007).

Consistent Account Files

/etc/passwd, /etc/shadow and /etc/group are three files that must agree. Two groups sharing a GID are one group to the kernel (HOST-USR-008). An account in passwd with no shadow line, a hash left in passwd, or a shadow line for a deleted user are signs of hand edits. They can also mean an interrupted removal (HOST-USR-009). pwck and grpck report the same. Home directories complete the picture: with others allowed in, any account can read another user's shell history and SSH keys or plant a .bashrc (HOST-USR-010).

In Summary

Secrets leak through readable files, keys without options, cron jobs that run writable programs and account files that disagree. Walk the configuration tree with bounds, restrict authorized_keys with from= and command=, keep cron programs and PATH root-owned, and reconcile passwd, shadow and group.

Apply It

These OpenVAPT checks put this module into practice. Open one to see its detection logic and source code.

Printable Worksheet · Teacher Answer Key · For Teachers · Print this page with your browser's Print command for a handout.

Also available as plain Markdown for notes, scripts and AI tools. Same facts, same source, no styling.

Lab

  1. Run: openvapt demo --only HOST-SEC-,HOST-CRON-,HOST-SSH-013,HOST-USR-008,HOST-USR-009,HOST-USR-010 --out p15 and, for each finding, write who gains what.
  2. In internal/lab/fixtures_containers_apps.go, follow the vulnerable /etc/crontab from PATH to the backup script and list every file a non-root user could change to run code as root.
  3. On a test machine you are allowed to assess: pwck -r ; grpck -r ; find /etc -type f -perm -0004 -name '*.conf' | head and compare with the report.

Check Yourself

Answers are checked in your browser and never stored or sent.

Question 1

1. A root cron job runs backup-db with no path. Where is the risk?

Question 2

2. What does from="203.0.113.0/24" in authorized_keys do?

Question 3

3. An account appears in /etc/passwd with x but has no /etc/shadow line. Why does it matter?

Question 4

4. What does HOST-SEC-001 report when it finds a secret in a world-readable file?

Question 5

5. A root cron job runs /usr/local/bin/backup.sh, and any user can edit that file. What follows?

References

Cite This Page

If this page helped your work, please cite it. The version and web address are filled in; the access date is today's date in your browser. Every other style, and when credit is required, is on How to Cite OpenVAPT.

APA 7
OpenVAPT. (2026). P20: Secrets, Cron and Account Hygiene (Version 0.1.0-alpha.6). OpenVAPT Academy. Retrieved October 16, 2026, from https://openvapt.com/academy/p20.html

In text: (OpenVAPT, 2026). Accessed: the date shown is today's date from your own browser (the site's build date without JavaScript); change it to the day you read the page.

BibTeX
@misc{openvapt_p20,
  author       = {{OpenVAPT}},
  title        = {{P20: Secrets, Cron and Account Hygiene}},
  year         = {2026},
  howpublished = {\url{https://openvapt.com/academy/p20.html}},
  note         = {OpenVAPT Academy, version 0.1.0-alpha.6. Accessed 16 October 2026}
}

Accessed: the date shown is today's date from your own browser (the site's build date without JavaScript); change it to the day you read the page.

Citing OpenVAPT does not mean OpenVAPT endorses, approves or has reviewed your work.