In the “Users Information” section, LinPEAS runs sudo -l, reads /etc/sudoers and /etc/sudoers.d/, checks for reusable sudo tokens, and inspects pkexec/polkit and doas. A highlighted NOPASSWD rule or an abusable allowed binary is often the fastest route to root — always in an authorised environment.
Where it appears in the output#
Sudo checks are in the Users Information section (users_information). If you know a valid password, pass it with -P so sudo -l and the su checks can use it. Without a password LinPEAS still reads every sudoers file it can access and reports the sudo version, which matters for version-based CVEs.
╔══════════╣ Checking 'sudo -l', /etc/sudoers, and /etc/sudoers.d
Matching Defaults entries for user:
env_reset, secure_path=/usr/local/sbin:...
User user may run the following commands:
(root) NOPASSWD: /usr/bin/find
(root) /usr/bin/vim /var/log/app/*.logHow to read a sudo finding#
- NOPASSWD rules are the highest-value leads — no password needed.
- Rules allowing shell-capable binaries (
find,vim,less,awk,tar) usually mean instant root via GTFOBins sudo techniques. - Look for wildcards (
/usr/bin/vim /var/log/*) — they can often be escaped to reach unintended files or arguments. - Check
env_keepfor dangerous variables (LD_PRELOAD,PYTHONPATH) and(ALL)runas specifications. - A flagged sudo version may indicate a known CVE (e.g. CVE-2021-3156, Baron Samedit on sudo < 1.9.5p2) — confirm the exact version, since distros backport fixes.
Cross-check any allowed binary against GTFOBins. find, vim, less, awk, tar and many others can spawn a root shell when sudo-allowed.
Reproduce the checks manually#
sudo -l # what can the current user run?
sudo -l -l # verbose: shows Defaults, env_keep, secure_path
sudo --version | head -1 # version -> check for sudo CVEs
ls -la /etc/sudoers.d/ # extra sudoers fragments
cat /etc/sudoers 2>/dev/null # readable only with privilegesFrom a sudo rule to a tested technique (authorised lab)#
The workflow mirrors the SUID one, using the sudo section of GTFOBins:
- 1
- 2
- 3
- 4
Dangerous sudoers patterns to recognise#
| Pattern | Why it is dangerous |
|---|---|
(ALL) NOPASSWD: ALL | Unrestricted root without a password — full compromise |
NOPASSWD: /usr/bin/vim (any shell-capable binary) | GTFOBins sudo escape → root shell |
Wildcards: /bin/cat /var/log/* | Often escapable to read or write outside the intended path |
env_keep+=LD_PRELOAD | Preload a malicious library into a root process |
(root) /usr/bin/sudoedit misconfigured | May allow editing arbitrary files as root |
Old sudo version (sudo -V) | CVE-2019-14287, CVE-2021-3156 (Baron Samedit) — verify patch level |
How to fix sudo findings (defensive)#
- Grant the minimum: specific binaries with fixed arguments, never
ALL. - Remove
NOPASSWDexcept where a service genuinely needs it; require authentication otherwise. - Avoid wildcards in sudoers paths — enumerate the exact files instead.
- Do not put dangerous variables in
env_keep; keepenv_resetand a tightsecure_path. - Patch sudo promptly; track CVEs like Baron Samedit against your actual build.
- Review
/etc/sudoers.d/regularly — fragments accumulate over time. - Re-run LinPEAS after hardening to confirm the findings are gone.
Frequently asked questions#
Does LinPEAS exploit sudo rules it finds?
No. LinPEAS only enumerates: it runs sudo -l, reads sudoers files and reports the version. It never attempts to abuse a rule — exploitation is always your manual, authorised step.
Why does LinPEAS ask for a password with -P?
Some checks (sudo -l, su brute-forcing of other users) need a valid password to run at all. -P supplies it so those checks are not skipped. Only use a password you are authorised to use, and be aware it can appear in shell history.
Is a NOPASSWD rule always exploitable?
Not always — it depends on the binary and its arguments. A NOPASSWD rule for a shell-capable binary (vim, find, less) is nearly always a direct path to root; a NOPASSWD rule for a narrow, non-interactive binary may be benign. Verify each rule individually.
LinPEAS flagged my sudo version — am I vulnerable?
Possibly, but verify. LinPEAS matches versions against known CVEs, while distributions backport security fixes without changing the version string. Check your distro's changelog for the CVE before concluding anything.
Can I hide sudo rules from LinPEAS?
You should not try to hide them — fix them instead. Restrict sudoers to least privilege, remove NOPASSWD where unneeded, and patch sudo. A scanner that cannot see a misconfiguration does not make it safe.
Background reading: how sudo and sudoers work, dangerous environment variables. Related checks: SUID, reading the output.
Sudo version CVEs worth knowing#
LinPEAS reports the sudo version because several serious sudo vulnerabilities are version-gated. The famous ones:
| CVE | Affected | Note |
|---|---|---|
| CVE-2021-3156 (Baron Samedit) | sudo before 1.9.5p2 | Heap overflow via sudoedit — reliable root on unpatched builds |
| CVE-2019-14287 | sudo before 1.8.28 | Runas-user -1 bypass: sudo -u#-1 ran as root |
| CVE-2019-18634 | sudo before 1.8.30 (pwfeedback) | Buffer overflow when pwfeedback enabled |
| CVE-2023-22809 | sudo before 1.9.12p2 | sudoedit arbitrary file edit via -- handling |
The usual caveat applies double here: distributions backport these fixes, so a version string that looks vulnerable may already be patched. Confirm with the distro changelog (apt changelog sudo, rpm -q --changelog sudo) before treating a version flag as a finding.
sudo in scripts and automation#
LinPEAS also surfaces the Defaults lines because they change how every sudo rule behaves:
env_resetwith a tightsecure_pathis the healthy baseline — note when it is missing.env_keepentries are allow-listed variables that survive into the root process; dangerous ones (LD_PRELOAD,PYTHONPATH,PERL5LIB) are escalation primitives.!authenticateorNOPASSWDon aDefaultsline widens every rule beneath it.- Scripts that call
sudonon-interactively depend on these defaults — a finding here can turn a benign automation into a vector.
When auditing, read the Defaults block before the user rules — it reframes what each rule actually permits.
sudo tokens and timestamps#
LinPEAS checks for reusable sudo tokens because they change the threat model: once a user has authenticated, sudo remembers it for a while (timestamp_timeout, default 15 minutes). During that window, any process running as that user — including a compromised one — can sudo without a password:
sudo -v # validate/refresh the timestamp (extends the window)
sudo -k # kill the timestamp immediately
sudo -l # still the first command you run- A long
timestamp_timeout(or!tty_tickets, which shares one timestamp across terminals) widens the window. timestampdirpermissions matter — if the timestamp files are manipulable, the timeout is fiction.- For automation that needs passwordless sudo, prefer a narrow
NOPASSWDrule for one binary over a long global timeout. - LinPEAS flags unusual timestamp configurations — treat them as hardening findings even when no binary rule is abusable.
sudo -l output: annotated example#
A real-world sudo -l block, annotated the way you should read it:
User analyst may run the following commands on web01:
(root) NOPASSWD: /usr/bin/nano /etc/app/*.conf # wildcard + editor = escape
(root) /usr/bin/systemctl status * # wildcard service name = wildcard unit
(deploy) /usr/bin/rsync # different runas user = lateral step- Read the runas user first —
(deploy)is not root, but it may own deploy keys or CI secrets. - Wildcards in the command position (
systemctl status *) let you smuggle arguments — check GTFOBins for the binary with those args. - Two rules for the same binary with different arguments are two separate tests — verify each.
- A rule you cannot explain is a finding until proven otherwise — ask the system owner what it is for, and check version control or config management for its origin.
Sources & references
- linPEAS README
- PEASS-ng release — reviewed 20260908-dffb9496
- HackTricks: Linux privilege escalation