TwoMillion
Recon
nmap_scan.log
.----. .-. .-. .----..---. .----. .---. .--. .-. .-.
| {} }| { } |{ {__ {_ _}{ {__ / ___} / {} \ | `| |
| .-. \| {_} |.-._} } | | .-._} }\ }/ /\ \| |\ |
`-' `-'`-----'`----' `-' `----' `---' `-' `-'`-' `-'
The Modern Day Port Scanner.
________________________________________
: http://discord.skerritt.blog :
: https://github.com/RustScan/RustScan :
--------------------------------------
🌍HACK THE PLANET🌍
[~] The config file is expected to be at "/home/rustscan/.rustscan.toml"
[~] Automatically increasing ulimit value to 5000.
Open 10.10.11.221:22
Open 10.10.11.221:80
[~] Starting Script(s)
[>] Running script "nmap -vvv -p {{port}} {{ip}} -vvv -sV -sC -Pn" on ip 10.10.11.221
Depending on the complexity of the script, results may take some time to appear.
Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times may be slower.
[~] Starting Nmap 7.93 ( https://nmap.org ) at 2024-07-28 09:26 UTC
NSE: Loaded 155 scripts for scanning.
NSE: Script Pre-scanning.
NSE: Starting runlevel 1 (of 3) scan.
Initiating NSE at 09:27
Completed NSE at 09:27, 0.00s elapsed
NSE: Starting runlevel 2 (of 3) scan.
Initiating NSE at 09:27
Completed NSE at 09:27, 0.00s elapsed
NSE: Starting runlevel 3 (of 3) scan.
Initiating NSE at 09:27
Completed NSE at 09:27, 0.00s elapsed
Initiating Parallel DNS resolution of 1 host. at 09:27
Completed Parallel DNS resolution of 1 host. at 09:27, 0.04s elapsed
DNS resolution of 1 IPs took 0.04s. Mode: Async [#: 2, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0]
Initiating Connect Scan at 09:27
Scanning 10.10.11.221 [2 ports]
Discovered open port 80/tcp on 10.10.11.221
Discovered open port 22/tcp on 10.10.11.221
Completed Connect Scan at 09:27, 0.08s elapsed (2 total ports)
Initiating Service scan at 09:27
Scanning 2 services on 10.10.11.221
Completed Service scan at 09:27, 6.16s elapsed (2 services on 1 host)
NSE: Script scanning 10.10.11.221.
NSE: Starting runlevel 1 (of 3) scan.
Initiating NSE at 09:27
Completed NSE at 09:27, 2.56s elapsed
NSE: Starting runlevel 2 (of 3) scan.
Initiating NSE at 09:27
Completed NSE at 09:27, 0.33s elapsed
NSE: Starting runlevel 3 (of 3) scan.
Initiating NSE at 09:27
Completed NSE at 09:27, 0.00s elapsed
Nmap scan report for 10.10.11.221
Host is up, received user-set (0.078s latency).
Scanned at 2024-07-28 09:27:00 UTC for 10s
PORT STATE SERVICE REASON VERSION
22/tcp open ssh syn-ack OpenSSH 8.9p1 Ubuntu 3ubuntu0.1 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 256 3eea454bc5d16d6fe2d4d13b0a3da94f (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJ+m7rYl1vRtnm789pH3IRhxI4CNCANVj+N5kovboNzcw9vHsBwvPX3KYA3cxGbKiA0VqbKRpOHnpsMuHEXEVJc=
| 256 64cc75de4ae6a5b473eb3f1bcfb4e394 (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOtuEdoYxTohG80Bo6YCqSzUY9+qbnAFnhsk4yAZNqhM
80/tcp open http syn-ack nginx
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-title: Did not follow redirect to http://2million.htb/
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
NSE: Script Post-scanning.
NSE: Starting runlevel 1 (of 3) scan.
Initiating NSE at 09:27
Completed NSE at 09:27, 0.00s elapsed
NSE: Starting runlevel 2 (of 3) scan.
Initiating NSE at 09:27
Completed NSE at 09:27, 0.00s elapsed
NSE: Starting runlevel 3 (of 3) scan.
Initiating NSE at 09:27
Completed NSE at 09:27, 0.00s elapsed
Read data files from: /usr/bin/../share/nmap
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 12.16 seconds└─$ grep 2mil /etc/hosts
10.10.11.221 2million.htbHTTP (80)
/invite
/inviteApplication is Single Page Application. The only url on current domain seems to be /invite


Enumerate for directories:
JS Shinanigans
Looks like API is in place and we can't just access stuff. On /invite we can notice /js/inviteapi.min.js which is obfuscated code.. I really didn't want to deobfuscate Javascript code, so why not let browser do it?!
Get all the functions in current window (inviteapi is loaded)
Convert interesting functions to strings and get actual functions!
Nice, makeInviteCode looks interesting.
Get invite code and Register
Decode ROT13:
Make same request to API:
Good, using this code we are able to get invited from /invite:

Platform
Creds: test02@2million.htb:test02:test02

VPN
In Access page we can download OpenVPN config to connect to network.

API
The request to /api/v1/user indicates that there are different APIs, probably admin and user.
If we make request to /api/v1 we get documentation of methods available:
Become admin
Using API methods become admin
Admin VPN
RCE
I don't think we are able to connect to VPN so let's try something else. The generated certificates look awfully similar to what linux tool generate, most probably the username is passed to the command line.
/api/v1/admin/vpn/generate is vulnerable to RCE
Applications env variables
Reverse Shell

Nothing interesting in the database.
SSH (22)
admin is a user on machine so we can try to SSH as him.
Creds: admin:SuperDuperPass123
User.txt
Privilege Escalation (root)
There's odd port open 11211, connection doesn't give anything and commands return ERROR...
Maybe it's not interesting..
Google -> linux 5.15.70-051570-generic exploit ->
A system is likely to be vulnerable if it has a kernel version lower than 6.2.
The exploitdb didn't work, so I moved to 2023 exploit.
Note: To use tmux inside a tmux session use handle twice. e.g.: Ctrl+B+B + " to split vertically.

Root.txt
Privilege Escalation (root) [v2]
[Following guided mode of HTB!]
The glibc version is vulnerable to CVE-2023-4911
Qualsys Blog Post: https://blog.qualys.com/vulnerabiliti... -
Qualsys Tech Details: https://www.qualys.com/2023/10/03/cve...
The given PoC is kind of complicated to make work,
Last updated