TryHackMe: Ollie
Begin with strange port and gain credentials from it, then using the creds to logs in on the web, after that chaining multiple vulnerability to gain reverse shell

Table of contents
Reconnaissance
Nmap scan resulting 3 open ports
Port 1337 is strange and i think it might be our entry point, so i tried to interact with it using netcat like so.
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/4fbdcfc5e4f60394f383980dec0a031eb206a875-1546x398.png)
Got prompted some question and then it give me a credentials, let's check the web.
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/67d94e665601a60a549fab53f3ff1f542b8e3291-1714x976.png)
Using our credentials we got before for login and i got redirected to the dashboard.
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/0a85f4fd514dac44a4f4c575a66f0ad68e879a61-1709x978.png)
Look at the bottom of the page there is a name and version of the CMS, let's search for some already exists vulnerability online.
I found script to gain RCE for version 1.4.5 and tried it but it seems didn't work so i found another interesting article here.
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/8c853d4b074e1021842cef98d08c787ecd4ca55d-907x502.png)
SQL Injection
Go to this url: "http://10.10.39.10/index.php?page=administration§ion=routing&subnetId=bgp&sPage=1" and then click action and subnet mapping and look at the search input, we can inject SQL here.
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/ee9df0bb26fdcb0bb114615772a1fed1300742e5-593x609.png)
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/3fc9ec585f986f17a42abbf483ededc84434487c-799x564.png)
Using PoC payload from fluidsattack and it works perfectly.
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/27268653327dbd1abbac5d3b637cfed55cfa2bef-800x191.png)
Since we already log in on the CMS, i think there is no reason to dump the database, so i think we can gain RCE here.
Remote Code Execution
First we need to check the user permission, is phpipam_ollie (our current user) have permission to write?
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/a04df394be4bbc176bf23ea161aaadf4e779f416-800x199.png)
Y means Yes, we can write a webshell here.
The hex above is a PHP code.
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/fa8f3f746b9303e4c7ceab73f8ea599ecb305ca9-1001x56.png)
Execute the payload above and let's make request with it.
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/24f61a9296d2894d096c9a9ef106418914196f95-568x75.png)
Shell as WWW-Data
Using encoded payload we can gain reverse shell here
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/aa03b82463165e64fc4c207e5e337ed17a54e480-1374x630.png)
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/da4dc2ec4a0d88869d4a0f6c7406d60dd1fce518-1764x56.png)
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/382a3e2d3118ca964e03a01b351b43dd5d49a44b-683x268.png)
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/0c4f14c51a03d9823e211ef853c7cf927e61f43d-491x91.png)
Shell as Ollie
Since we got user Ollie here, let's try to privilege escalation to Ollie using password used before for logs in to the web.
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/d030cf18c20746ae75cb16f94bf1615f37e871ca-440x78.png)
It works!
Then i grab pspy64 and run it.
Found an interesting process, feedme ?
![[Gambar tidak memiliki deskripsi]](https://cdn.sanity.io/images/7blsog1k/production/e641affaadf555453fb94edf9d7992ede8d822b0-935x240.png)
Weird as f*ck, it's owned and running by root but since Ollie is on the group we can freely write to it. Let's gain root shell.
Shell as Root