Hip Flask

Room Link: https://tryhackme.com/r/room/hipflaskarrow-up-right

Scans

Initial scan

Kali

nmap -A $VICTIM

Longer scan

Kali

UDP/53 - DNS

Kali

Kali

Kali

TCP/80:443 - HTTP(s)

Kali

Kali

main.py

There is a secret key in this file

Kali(poc-venv)

Kali(poc-venv)

poc.py

Kali(poc-venv)

Copy the token to firefox and then we can login

Kali(poc-venv)

Changing the code to see if it will evaluate 7*6 in the username field

poc2.py

Kali(poc-venv)

Do the same steps as before to use the cookie and you can see the username is now 42

Inital Shell

Kali(poc-venv)

Changing the code to see if it will evaluate 7*6 in the username field

poc3.py

Kali

Kali(poc-venv)

Copy the cookie into the browser again and shortly you should receive a connection to your netcat listener.

Privilege Escalation

Get autocomplete

Victim

CVE-2021-3560 is, fortunately, a very easy vulnerability to exploit if the conditions are right. The vuln is effectively a race condition in the policy toolkit authentication system.

There is already a TryHackMe room which covers this vulnerability in much more depth herearrow-up-right, so please complete that before continuing if you haven't already done so as we will not cover the "behind the scenes" of the vuln in nearly as much depth here.

Effectively, we need to send a custom dbus message to the accounts-daemon, and kill it approximately halfway through execution (after it gets received by polkit, but before polkit has a chance to verify that it's legitimate -- or, not, in this case).

We will be trying to create a new account called "attacker" with sudo privileges. Before we do so, let's check to see if an account with this name already exists:

Victim

This attempts to create our new account, and times how long it takes for the command to finish. In the target machine this should be about 11 milliseconds. It took us 13 milliseconds

Victim

We now need to take the same dbus message, send it, then cut it off at about halfway through execution. 5 milliseconds tends to work fairly well for this box.

Note: you may need to repeat this a few times with different delays before the account is created.

Victim

Victim

Victim

Victim

Victim

Last updated