🀨Whats Your Name?

License

The following post by anthonyjsaab is licensed under CC BY 4.0arrow-up-right

0 - Introduction

Link to room: https://tryhackme.com/r/room/whatsyournamearrow-up-right

Machine version: whatsyournamev1.87

This writeup walks you through a room on TryHackMe created by tryhackmearrow-up-right, 1337rcearrow-up-right, l000g1carrow-up-right

1 - Port Scan

1a - Discovery

β”Œβ”€β”€(kaliγ‰Ώkali)-[~]
└─$ sudo nmap -sS -T4 -p- 10.10.58.228
[sudo] password for kali: 
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-05-01 08:42 EEST
Nmap scan report for 10.10.58.228
Host is up (0.11s latency).
Not shown: 65532 closed tcp ports (reset)
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
8081/tcp open  blackice-icecap

Nmap done: 1 IP address (1 host up) scanned in 388.39 seconds

1b - Versioning and OS fingerprinting

2 - Web server probing

Comment hints at login.php page existing
We forgot to add the target machine's IP address to our /etc/hosts
worldwap.thm redirects to this page

3 - XSS

3a - Payload injection

Submitting XSS payloads to get the cookie of the mod and the URL they asked for
login.worldwap.thm should also be added to /etc/hosts

After a minute or so, the moderator detonates the payload by browsing our registration submission and their browser sends us the following:

Changing my cookie to the mod's cookie, effectively impersonating them
The form on the dashboard is deactivated. We should go to login.worldwap.thm to continue
We should go to /login.php

3c - Mod flag

/login.php redirects us to /profile.php because the cookie we got is valid for the subdomains too

4 - Probing WORLDWAP

Most features on the website are static and do nothing. The only features that are dynamic are the chat and the change password pages.

4a - Change Password form

We can send requests, but the server tells us that it won't work with the mod user

4b - Chat

This page is interesting. We can only talk with a bot named admin. We can reset the bot and clear the chat.

5 - A closer look at the chat

We sent a link that points to our Kali machine to see if the bot clicks on link, and it does! But this is a dead end
Trying to inject JS alert into the page
It works! This is a stored XSS. We can use it for a CSRF attack

6 - Finding the correct payload

Through the discovered XSS vuln, we can make the bot send a forged request to change it password.

First, we copy what the request should look like by trying the change password page again:

A better and simple payload would be:

We will clear the chat and try:

It seems something is broken since no request was sent from our browser to change_password.php

It did not work. If it doesn't work on our own browser, it will not work in the admin's browser. What is the problem? It turns out the payload is being modified before being stored, breaking everything:

<a> tags were added by the server around the link in our payload

We just need to bypass link detection and we are good to go!

We clear the chat and try again:

Voila! A forged request was send

7 - Getting the flag

We reset the bot to trigger chat browsing. This should have changed the password of the admin's account. We try to login:

Last updated