Pylon CTF
Pylon CTF
jpg
- Decoding the file, results in what appears to be a gzip file, possibly a tar archive?
- This SSH key is unencrypted and will allow us to connect to the machine.
- Next step is port mapping, using rustscan, reveals the following TCP ports open
- Ports 22 and 222 both appear to be running OpenSSH, lets try and connect to them.
- We now have flag1 and a password, so let’s try those on port 22.
- We also have a couple more interesting file’s / folders to look at, one being a file encrypted with gpg the
other being a folder with the sources for the password manager and a .git folder.
- We can see some files have changed here and an interesting .db file appears.
- Running the pyLon_pwMan.py with python3, the program informs us that the database file exists and prompts us
for the encryption key, now if you are a good guess, you will try the same encryption key as before.
- This leads you to a password for the gpg key to decrypt the file, if you are not a good guess you will likely
get stuck here and not progress, this older version uses a much more insecure encryption method, xoring the
password with the MD5 hash of the passphrase, since there is only one password in the database, your next move
would be to brute force the SHA512 hash stored in the .db file, which would probably prove frivolous as it is
using a reasonably strong passphrase, I may be wrong but I don’t think it’s feasible to do this.
- Decrypting the ‘note_from_pood.gpg’ file gives us the password to shift horizontally to another user, but
first let’s see what lone can do with sudo.
- Interesting we can run openvpn as root, but only using a specific config file, pood has asked us to fix the
config and has given us access to his account, so let’s switch to him.
- Now we have user2 flag, and we can see that pood can edit the openvpn config file that lone was allowed to
run, so what now?
- Reading the man page for openvpn we see that we can run a script on successful connection to a VPN server, so
lets write a script to take control of the machine.
- There are many ways to do this, but the usual trick of copying /bin/bash to /tmp and setting the binary SUID
should do the job, I knock up a quick shell script.
- Don’t forget to make it executable, now we must edit the config file.
- Add a couple of lines to the config and save, now exit out of the su shell and go back to lone, connect to the
openvpn server and our script should run as root on successful connection.
- The connection was successful so let’s disconnect and check out /tmp/bash.
- The way I dealt with that was to edit /etc/shadow, I copied a known hash into root’s position and then all we
can su to root, in this case I just copy pasted pood’s hash as it is already known and easy to grab.
- Notice I also overwrote pylon’s hash, just for fun, you can go this way too because pylon is in the sudo
group.
- Hope you enjoyed the room, my fist one, I have some other ideas up my sleeve so stay tuned.