Obscurity

Obscurity is a Medium Difficulty linux box that deals with python exploitation and race conditions

Recon

we start off by scanning Obscurity's IP 10.10.10.168 with nmap

From our scan we get the following results

We find that there is a webpage hosted via a BadHTTPServer on port 8080, So lets take a look at what we have

We find that we have some useful information that we can later use right on the webpage

As well as a clue that there is a server we can access at a undisclosed location with the name SuperSecureServer.py

We can start fuzzing with https://github.com/ffuf/ffuf

And we do indeed get a hit!

So we know that at 10.10.10.168:8080/develop/SuperSecureServer.py we can get the development server.

On line 139 we find a exec function that does not sanitize the URI prior to including it as part of the info string. To this end we can potentially create a reverse shell.

And yes we get a shell!

Enumerating the user dir robert we find a file encrypter/decrypter SuperSecureCrypt.py and a check.txt file that tells us Encrypting this file with your key should result in out.txt, make sure your key is correct!

In addition to this we also find a encrypted file called passwordreminder.txt so lets pull everything down!

we can use b64 to encode and copy the files to our side and decode to their original states

Exploit

We can use the following script to get the key

We can use the following script to decrypt the password

Running the script we get SecThruObsFTW

We can now ssh with the credentials robert:SecThruObsFTW

Post Exploitation

Doing a simple sudo -l reveals that we can run sudo in the following context

Running the above however sudo /usr/bin/python3 /home/robert/BetterSSH/BetterSSH.py results in a error FileNotFoundError: [Errno 2] No such file or directory: '/tmp/SSH/19WB3lNH' upon creating the tmp/SSH directory however we get Authed and have a new shell

Checking on the source code of BetterSSH we see that it writes the contents of shadow to disk, reads, auths & deletes it which gives us a chance to get root hash

To achieve this we will open a second ssh session and run

and from the original we will run sudo /usr/bin/python3 /home/robert/BetterSSH/BetterSSH.py again

and with that we have root's hash, now to call up john and crack it

And we get root credentials root:mercedes unfortunately we cannot ssh using it but we can use su in a ssh session and get root

Last updated