Home CTF Writeups About

Tomghost


Started with nmap scan added --open, -p- and -A. Ports 8009 and 8080 initially stuck out.

tomghost-images/72-1.png

Gobuster, nothing stood out to much except the potential manager dashboards potentially offering jsp upload vulns

tomghost-images/72-2.png

Further enumeration port 8009 ajp

tomghost-images/72-3.png

browsed to port 8080

tomghost-images/72-4.png

/manager page gets unauthorized response

tomghost-images/72-5.png

Used book hacktricks guide to attempt to bypass the block

https://book.hacktricks.xyz/network-services-pentesting/8009-pentesting-apache-jserv-protocol-ajp

tomghost-images/72-6.png

Able to port the web app from 8009 through localhost and got to the credentials box, but no luck with default credentials, brute seemed premature, without username

tomghost-images/72-7.png

book hacktricks provided another vector which might reveal credentials

tomghost-images/72-8.png

tomghost-images/72-9.png

!Found credentials using this method user: sk...: 87....

Firstly tried to ssh with the credentials. Yes, it worked!

Found 2 files right away. Looks like a pgp file and a decrytion key.

tomghost-images/72-10.png

Decided to do some manual enum before pursuing the obvious path.

tomghost-images/72-11.png

Not much...

tomghost-images/72-12.png

Not much...crontabs...not much...

tomghost-images/72-13.png

found another user name....the first flag is in that user home directory and is readable!

tomghost-images/72-14.png

not much more here...

tomghost-images/72-15.png

...not much in these

tomghost-images/72-16.png

decided to run enum just because, I have the PGP vector but interested to see if anything else shows up. Not much here...this stands out due to kernel version running (4.4.0)but decided to put it to the side.

tomghost-images/72-17.png

back to the path...copied the pgp into a file on kali machine

tomghost-images/72-18.png

tomghost-images/72-19.png

search for gpg2john to create a hash of the pgp key for cracking by john

tomghost-images/72-20.png

tomghost-images/72-21.png

search for john to crack the pgp hash

tomghost-images/72-22.png

Found the passphrase to decrypt the pgp key

tomghost-images/72-23.png

decrypted the key, the file contains the credentials of the other user: Merlin.

tomghost-images/72-24.png

tomghost-images/72-25.png

switched user to merlin

tomghost-images/72-26.png

checked merlins sudo privileges and check GTFObins for the code to /usr/bin/zip

tomghost-images/72-27.png

run the code. Oh yeah! Got root!

tomghost-images/72-28.png

cat the root flag.

tomghost-images/72-29.png