The idea
Recon on the Harlow Dispatch depot box is done. The last lab found the way in and left it in your evidence: the
operator account ops, still on its shipped default password ops, reachable over SSH. Now you use it.
The skill in this stage is reading what kind of opening you hold. A known-vulnerable version wants an exploit, a web
flaw wants a crafted request, and a default credential wants nothing but a login. Yours is the third kind, the
simplest of the lot. You finish with a low (non-root) shell, the foothold the Get-root playbook starts from.
Steps
-
The call: which kind of way in?
With a target in front of you, it is tempting to open an exploit framework straight away. Read the opening first. Openings come in three kinds, and each wants a different move:
- A known-vulnerable version wants a matching exploit, such as a Metasploit module or a public proof-of-concept, that you still have to find and get working.
- A web-app flaw wants a crafted request aimed at the app: an injection, an upload, a traversal.
- A default or stolen credential wants nothing clever. You log in.
Yours is the third kind:
ops / opsover SSH. So you skip the exploit modules and leave the web app alone. One thing is worth doing first: confirm the login still works, so you know the door opens before you lean on it.hydradoes that. Give it the service and the one login to try, and it tells you whether it works.attacker:~# hydra -l ops -p ops -t 1 -f ssh://10.0.1.20
-
Open the shell
Now turn the login into a shell on the box.
sshlogs in;sshpass -p opsfeeds it the password so it runs without stopping to prompt. Put a command such asidafter the host and SSH runs it on the target and prints the result, so one line both logs in and tells you who you became.Watch what
idreports. You logged in asops, an ordinary operator account, not root. A session is only as powerful as the account behind it, so a default operator login gives you an operator's shell, not the run of the box. Then read the box's own console record, to be sure you are on the host the opening named.attacker:~# sshpass -p ops ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ops@10.0.1.20 id attacker:~# sshpass -p ops ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ops@10.0.1.20 cat /opt/dispatch/console.txt
-
A foothold, not the keys to the box
A first shell feels like the whole prize. It isn't yet: you are in, not in charge. As
opsyou can run the operator's commands, but the box still keeps its secrets from you. The clearest test is the password file,/etc/shadow. It holds every account's password hash, and only root may read it. Try to read it through your session and watch the box refuse.That refusal is the line between a foothold and full control, and it is the gap the Get-root playbook closes. From here an attacker looks for one thing the box was left doing wrong and uses it to turn
opsintoroot. That is the next lab. This one ends with the shell.attacker:~# sshpass -p ops ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ops@10.0.1.20 cat /etc/shadow
-
The defender's answer
The whole intrusion turned on one thing: a shipped default password nobody changed. There was no exploit, so there is nothing to patch. Close the default and the door is gone. Here the operator changes
opsto a long, unique password, and the credential you walked in with stops working at once.Change it on the box, then try the old login again from the attacker and watch it fail. Three habits would have stopped this. Change every shipped default credential before a box goes live. Patch the services, so a version is never a free lead. And run each service under a least-privilege account, so a login that does leak lands a shell as limited as the one you held, never root.
dispatch:~# chpasswd attacker:~# sshpass -p ops ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ops@10.0.1.20 id
Run these steps on real machines