PyExp
Last updated
Last updated
With only SSH
and MySQL
open we can start bruteforcing MySQL. As the root account generally always exists we can start by bruteforcing this using the rockyou.txt wordlist.
With the valid credentials of root:prettywoman
we can now login to MySQL.
Viewing available databases we find the database 'data' which contains a table called 'fernet'. This table contains a token and key as shown below.
The values are:
I tried decoding these with base64 and a few others. No luck with any legible output. Researching the words fernet and encode give us the following result: https://asecuritysite.com/encryption/ferdecode
Entering the details we have found give the results below.
These credentials returned are: lucy:wJ9`"Lemdv9[FEw-
Which allow us to login with SSH as the user lucy.
Checking sudo permissions with sudo -l
shows we can run /usr/bin/python2 /opt/exp.py
as root without specifying a password.
Reading the contents of /opt/exp.py:
Looks like this script will ask us a question which prompts raw input. If we can escape the shell whilst the script is active we should be able to maintain escalated privileges. Use the command below to escape the shell when prompted for input.