The idea
Kaveh has a signed engagement against Bowmont Haulage and a foothold on their dispatch box as the service
account dispatch. Nothing jumps out: no NOPASSWD rule, no odd setuid binary. That is the normal case, and
it is why escalation almost always opens with enumeration — reading the box, patiently,
for the one thing left wrong.
Here the one thing is a secret in the open: a deploy-automation .env left world-readable, holding the very
password dispatch logs in with — and dispatch may run sudo. You will sweep the box by hand, confirm it
with linpeas, read the password out of the file, and hand it to sudo -S to become root.
Steps
-
The foothold, and the wall it stops at
You are on Kaveh's Kali box. The foothold is an SSH login on the dispatch box at
10.0.1.20as the service accountdispatch. Click Start to open a shell there, confirm who you are withid, then try the prize straight away —/etc/shadow— and watch it refused. That wall is what enumeration will get you past.kali:~# ssh box
-
The early wins come up empty
Start where every escalation starts — the two cheapest checks.
sudo -n -lasks, without prompting, what you may run as root;find / -perm -4000lists every setuid binary, the files that run as their owner. On a soft box one of these ends it. On this one neither does: sudo wants a password you do not have, and the only setuid files are the stock system ones. No free win — so you keep reading.kali:~# ssh box 'sudo -n -l' kali:~# ssh box 'find / -perm -4000 -type f 2>/dev/null'
-
Read the box for secrets
Applications and their deploy tooling leave secrets on disk — in config files,
.envfiles, scripts, history. An ordinary account can often read them because nobody tightened the permissions. Sweep the obvious home for an app's files —/opt, where vendored and deploy tooling lands — for anything that looks like a credential.kali:~# ssh box 'grep -rin pass /opt 2>/dev/null'
-
Sweep it faster with linpeas
By hand you found one secret. linpeas runs hundreds of these checks in one pass — readable config and
.envfiles, credentials, history,/optcontents, sudo, setuid, writable paths — so nothing a hand sweep would miss gets missed. It is on your Kali box at/usr/share/peass/linpeas/linpeas.sh; the target has no internet, so copy it over the foothold withscp, then run only the interesting-files checks so it stays fast. Watch it run its password and/optsweeps — the ones that cover the file you already found.kali:~# scp /usr/share/peass/linpeas/linpeas.sh box:/tmp/linpeas.sh kali:~# ssh box 'bash /tmp/linpeas.sh -N -q -o interesting_files'
-
Own the box
sudo wanted one thing:
dispatch's password. You have it.sudo -Sreads that password from standard input instead of a terminal, so you can pipe it straight in over the foothold — no interactive prompt. Runidas root to prove it, then read the/etc/shadowthat was closed to you in step one.kali:~# ssh box 'echo "D1spatch-0ps!" | sudo -S -k id' kali:~# ssh box 'echo "D1spatch-0ps!" | sudo -S -k cat /etc/shadow'
-
What Bowmont's admin should change
Kaveh's finding is not "sudo is dangerous" or "linpeas is dangerous". It is that a secret on disk that an ordinary account can read is a root password, the moment that account can
sudo. The fixes, in order:- Keep secrets out of readable files. The deploy password belongs in a secrets manager or a file scoped to
the one account that needs it (
0600, owned by that account) — never0644under/opt. Rotate it, since it has now leaked. - Do not reuse a login password as a sudo/deploy password. One leak unlocked both. Separate credentials, so reading a deploy file does not also hand over the account's sudo.
- Scope the sudo rule.
dispatch ALL=(ALL:ALL) ALLlets the account run anything as root. The nightly deploy needs a short list of commands, not all of them — grant those, so a leaked password buys far less. - Watch for it.
sudologs every command to the auth log, so Bowmont's SOC would seedispatchrunningcat /etc/shadowas root — an ops account reading the hash file is the tell.
One honest line: running any of this against a system whose owner has not authorised you in writing is unauthorised access, an offence under laws like the UK Computer Misuse Act and the United States' CFAA. Kaveh has a signed engagement; that permission is the only thing separating this from a crime.
kali:~# ssh box 'ls -l /opt/bowmont/deploy/.env'
- Keep secrets out of readable files. The deploy password belongs in a secrets manager or a file scoped to
the one account that needs it (
Run these steps on real machines