โ˜ ๏ธCybermonday - HTB

https://app.hackthebox.com/competitive/2/overview

Container Foothold

register in the website then login

any duplicated input will trigger the laravel debugger ,so we try to change the username to admin and try to update it

that will expose alot of information ,files path env file ..etc

Nginx off by slash fail

getting the .git folder and dump it

you will get a backup files for the cybermonday web app source code files and we find below code

so we know isAdmin is a parameter we can use ,lets set isAdmin value to 1

now you are admin

we also found a new subdomain after fuzzing the root we find

lets create a user /auth/register

login with the created user /auth/login

To create a webhook service ,we need admin role ,and current token has user role only

now we take the token and use jwks.json to extract the public key first

then we change the value of role to admin using the extracted pem key

Now we get into the other part ,check /webhooks endpoint

lets create another service 'sendRequest'

there is no filter or restriction on user input for the url parameter and we can inject things on method parameter, also we they do have running redis

i did some local redis testing to see how it will react ,and my conclusion was that ,if im able to communicate with redis and send commands ,i can set the laravel_session for a user on Cybermonday.htb site ,since its laravel

so first lets try to decrypt the user session

after reading env file ,we got APP_KEY ,now we move on ,to decrypt the session token

as per HERE you need app_key to decrypt X-XSRF-TOKEN value to be able to occur unserialize call

from the previous decrypt part code from hacktricks we modify few things

i run redis locally ,and tried to reach it out through the webhook sendRequest to find out how im gonna inject and how its gonna work on the remote redis db

it Works !

now lets set laravel_session value that we found earlier in the env file

let's get the user cybermonday_session and note its not working for XSRF_TOKEN token

you can download the phpgcc gadget repo ,use this command to remove any json escapes to use it with burp

Now we got container foothold !

Note: Refereshing the user page ,will trigger the unserialized error.

User - Path

Network Scan

now we uploaded nmap ,and also we need to upload chisel to forward ports ,we will be interested in port 5000 ,docker registery ,lets try to pull that

Chisel connected

lets now try to pull it locally

app/controllers/LogsController.php
app/helpers/Api.php

here we found a password ,also from the first container reverse shell ,we find a username in /mnt/.ssh/authorized_keys

Root

To bypass the check ,we have to create two yamls configuration files ,first one is legit ,and second one is malicious ,we connect both of them using extend ,and in malicious yaml we use volumes to mount /root dir ,and command ,to execute a reverseshell

docker-compse.yml

malicious-compose.yml

confirm if its working

run

Last updated