PATH is the list of directories the shell searches for commands. If a privileged process calls a command by name (not full path) and a directory you can write to appears earlier in PATH — or PATH contains '.' — you can plant a malicious binary with that name and have it run with the process's privileges.
What is PATH?#
When you type ls, the shell searches each directory in $PATH in order and runs the first match. Programs that invoke other commands by bare name inherit this behaviour.
Why LinPEAS checks path#
LinPEAS prints PATH and flags writable entries and any current directory (.) in it, because these enable command-shadowing against SUID binaries, cron jobs and systemd units that call commands by name.
What a normal configuration looks like#
PATH contains standard system directories (/usr/local/bin, /usr/bin, /bin, /sbin) that only root can write to, and no . entry.
Why it can be security-sensitive#
A writable directory early in root's PATH, or a . entry, means a privileged process that runs a bare command name can be tricked into running your file instead. Combined with a SUID binary that calls, say, service without a full path, this is a direct root path.
Understanding the concept tells you whether a LinPEAS highlight is a real problem here. The tool flags candidates; you confirm exploitability in context, and only act where authorised.
How to check it manually#
Run these read-only commands to inspect this area yourself and validate what LinPEAS reports:
echo $PATHfor d in ${PATH//:/ }; do [ -w "$d" ] && echo "writable: $d"; doneecho $PATH | tr ":" "\n" | grep -n "^\.$"Defensive remediation#
- Remove writable and '.' entries from privileged PATHs.
- Set an explicit, minimal PATH in cron and systemd units.
- Have privileged programs call other commands by absolute path.
Sources & references
- HackTricks: Linux privilege escalation
- GTFOBins — abuse techniques for standard binaries
- PEASS-ng repository — reviewed 20260908-dffb9496