$ nmap -p- --min-rate 5000 10.129.29.200
Starting Nmap 7.93 ( https://nmap.org ) at 2023-05-06 09:49 EDT
Nmap scan report for 10.129.29.200
Host is up (0.018s latency).
Not shown: 40271 closed tcp ports (conn-refused), 25261 filtered tcp ports (no-response)
PORT STATE SERVICE
22/tcp open ssh
53/tcp open domain
80/tcp open http
DNS being open was the most interesting one.
Login Credentials
Port 80 reveals a defualt Apache2 Ubuntu page:
When we add bank.htb to our /etc/hosts file and revisit it, it loads a login page:
There was no SQL Injection or anything on this, and default credentials don't work. I did a gobuster scan next to enumerate the possible endpoints.
For some reason, when I run this binary, it gives me a root shell.
Turns out, the source code for the script is here (and it is super unrealistic):
www-data@bank:/tmp$ cat /var/htb/emergency#!/usr/bin/pythonimport os, sysdefclose():print"Bye" sys.exit()defgetroot():try:print"Popping up root shell.."; os.system("/var/htb/bin/emergency")close()except: sys.exit()q1 =raw_input("[!] Do you want to get a root shell? (THIS SCRIPT IS FOR EMERGENCY ONLY) [y/n]: ");if q1 =="y"or q1 =="yes":getroot()else:close()