Pollution
Enumeration
Rustscan
mkdir rust; sudo rustscan -t 1500 -b 1500 --ulimit 65000 -a 10.10.11.192 -- -sV -sC -oA ./rust/{{ip}}# Ports
Open 10.10.11.192:22
Open 10.10.11.192:80
Open 10.10.11.192:6379
# Services
PORT STATE SERVICE REASON VERSION
22/tcp open ssh syn-ack ttl 63 OpenSSH 8.4p1 Debian 5+deb11u1 (protocol 2.0)
80/tcp open http syn-ack ttl 63 Apache httpd 2.4.54 ((Debian))
|_http-server-header: Apache/2.4.54 (Debian)
|_http-title: Home
| http-cookie-flags:
| /:
| PHPSESSID:
|_ httponly flag not set
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
6379/tcp open redis syn-ack ttl 63 Redis key-value store
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernelPort 80
Checking the website will reveal the real hostname collect.htb We'll add it to /etc/hosts for further enumeration
Port 6379
Nothing interesting because we aren't authenticated
Subdomains
Dirsearch
Just collect.htb delivered some interesting results for example /api
collect.htb
developers.collect.htb
Basic Auth Pop Up, we have no credentials at the moment
forum.collect.htb
Seems to be a a forum for members of collect.htb where they are able to ask questions and get help Collect-Forum
First let's register an account at Register
We are also able to get some infos about the environment when we study the threads posted.
Victor(a Dev) has trouble accessing the pollution api. Attachment contains environment infos T-13
Kubernetes? T-9
John responsible for developers.collect.htb? T-2
API Token
Once we downloaded the attachment of http://forum.collect.htb/showthread.php?tid=13 we discovered it's a burp history file.
Lets decode it an view it in our browser
Checking the formatted logs we will discover a request that can be used to gain admin access
Exploitation
API XXE
Register an account on collect.htb and capture the requests in burp Use the previously discovered token to elevate our privileges
Open Collect - Admin in your browser, register a new API User and capture the request
After some try and error we are able to read files . Check bootstrap.php to receive the redis password!
xxe.dtd Do it for index.php to get an overview and than check bootstrap.php which is mentioned in index.php While poking around we also discovered /var/www/developers/.htpasswd
Burp Request
bootstrap.php
htpasswd
developers.collect.htb 1
We'll use the basic auth creds to get a view of developers.collect.htb but there's nothing except a new login panel
Redis
We are now also able to access redis
developers.collect.htb 2
We have successfully bypassed the login page and can now see the developers section.
The parameter ?page is vulnerable to remote code execution using filter chains. We will use this project Filter Chain Generator to get an reverse shell on the system :)
Prepare Filterchain
x
Shell
Shell
Once we got our shell we can enumerate further
php-fpm
Using netstat we can see a couple of open ports. Port 9000 catched my eye as this could be an fastcgi application.
Privesc to Victor
We'll use this script to escalate our privileges to user "victor"
Privesc Root
Once we have a shell as victor we start to enumerate the box again.
Enumeration
Seems like we can access the pollution_api source code
Check for any processes that are related to our api
/home/victor/pollution_api/controllers/Messages_send.js While parsing through the source code we can spot a possible prototype pollution vulnerability But checking the code will tell us that we need admin permissions on the api.
Getting API Admin Role
Using our discovered mysql credentials we are going to elevate the permissions of our api user that we created earlier
API Fun
API Token
Login using our creds to get our api token
API Documentation
RCE
We will chmod +s /usr/bin/bash so that we can get to root by using /usr/bin/bash -p
Root
We're now root and get the last flag in /root
Last updated