Information
Room
- Name: Cat Pictures
- Profile: tryhackme.com
- Difficulty: Easy
- Description: I made a forum where you can post cute cat pictures!
Write-up
Overview
Install tools used in this WU on BlackArch Linux:
Network enumeration
Port and service scan with nmap:
Let's add a local domain:
Service discovery
We found an unusual service on port 4420, let's try to connect to it.
Right now we don't have credentials so let's try the web service instead.
Web discovery
http://catpictures.thm:8080/ is hosting a phpBB forum.
If the doc folder was properly updated, http://catpictures.thm:8080/docs/CHANGELOG.html
should leak the version og phpBB, so it could be using phpBB 3.3.3.
At the time the last release is phpBB 3.3.4 so 3.3.3 is unlikely vulnerable.
We must rather look for information.
There is only one forum post: http://catpictures.thm:8080/viewtopic.php?f=2&t=2
POST ALL YOUR CAT PICTURES HERE :)
Knock knock! Magic numbers: 1111, 2222, 3333, 4444
It's a hint giving us a Port knocking
combo to try.
Port knocking
We can look at Rubyfu
to find how to write a simple Port knocking script in ruby.
It's actually a script I wrote for The Great Escape - Write-up - TryHackMe and submitted to Rubyfu.
Let's run it:
Now if scan ports again, we'll see the FTP port is open:
FTP discovery
We can connect to the FTP server anonymously and retrieve the only file.
Internal Shell Service (4420)
We should now be able to connect to the shell service.
Note: connecting with telnet
won't work while connecting with ncat
or nc
will work.
It looks like we are in a chroot or a jail. So let's try to escape it.
We can see we have nc
and mkfifo
, let's check revshells.com
and use the nc mkfifo
technique.
On our listener:
Escape the jail
There is a weird binary here:
It's password protected and the password we used previously doesn't work here.
Has we don't have much commands available on the server, let's retrieve the binary.
We can use the password on the runme
service and it copies us a SSH private
key.
Fix the permissions:
Connect over SSH.
System enumeration
Now we have escaped to the docker container, we know we run in one because of
/.dockerenv
.
So we will probably have to escape the container to the host.
By the way let's loot the 1st flag:
Running LinPEAS show us an uncommon script: /opt/clean/clean.sh
.
The content is useless for us but we can edit it.
Elevation of Privilege (EoP): escape docker container
I'm to lazy to run pspy and see if it's called fro ma cron job, I'll rather modify
it and wait.
Let's add a reverse shell to the script.