Headless

https://app.hackthebox.com/machines/Headless/

image

Port Scan


PORT     STATE SERVICE REASON  VERSION
22/tcp   open  ssh     syn-ack OpenSSH 9.2p1 Debian 2+deb12u2 (protocol 2.0)
| ssh-hostkey:
|   256 90:02:94:28:3d:ab:22:74:df:0e:a3:b2:0f:2b:c6:17 (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJXBmWeZYo1LR50JTs8iKyICHT76i7+fBPoeiKDXRhzjsfMWruwHrosHoSwRxiqUdaJYLwJgWOv+jFAB45nRQHw=
|   256 2e:b9:08:24:02:1b:60:94:60:b3:84:a9:9e:1a:60:ca (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICkBEMKoic0Bx5yLYG4DIT5G797lraNQsG5dtyZUl9nW
5000/tcp open  upnp?   syn-ack
| fingerprint-strings:
|   GetRequest:
|     HTTP/1.1 200 OK
|     Server: Werkzeug/2.2.2 Python/3.11.2
|     Date: Sun, 24 Mar 2024 03:39:26 GMT
|     Content-Type: text/html; charset=utf-8
|
| << -- SNIPPED -- >>

Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Dir scan

User

image

XSS on User Agent

I tried fuzzing payloads on the support page, but no luck. So I moved with HTTP headers, since the machine name also gave hint on headers.

image

After few seconds, we get Admin cookie on our python server

image

Let's head to /dashboard with admin.

image

Cmd injection

On the date parameter, I noticed Command Injection. Payload : date=2023-09-15%3bsleep+3. Got response 3 seconds later.

  • For user I used following payload:

  • And now we got user flag

Root

Root on this machine was toooooo easy

syscheck was a BASH script.

After reading it, we can find the vulnerability within seconds.

It's using the initdb.sh file from current directory, we just need to make a script called initdb.sh and put /bin/bash in it.

  • After running the script as sudo we get the root shell

__________heapbytes's still pwning.

Last updated