Day 9
Deploy the attached VM, and wait a few minutes. What ports are open?
80
What framework is the web application developed with?
Using whatweb
to enumerate this website shows
The response of the network browser also confirms it
Laravel
What CVE is the application vulnerable to?
Search on google for Laravel CVE we can find this blog post:
CVE-2021-3129
What command can be used to upgrade the last opened session to a Meterpreter session?
Note that normal command shells do not support complex operations such as pivoting. In Metasploit’s console, you can upgrade the last opened Metasploit session to a Meterpreter session with sessions -u -1
.
sessions -u -1
What file indicates a session has been opened within a Docker container?
A common way to tell if a compromised application is running in a Docker container is to verify the existence of a /.dockerenv
file at the root directory of the filesystem.
/.dockerenv
What file often contains useful credentials for web applications?
The env file is a great way to find interesting things, usually on /var/www/.env
or we can do a wide search on the OS with find /tmp -iname .env -type f
What database table contains useful credentials?
Gain access to remove machine with metasploit
Get meterpreter session
Inside the .env
file
Lets try to resolve this DB_HOST
As this is an internal IP address, it won’t be possible to send traffic to it directly. We can instead leverage the network pivoting support within msfconsole to reach the inaccessible host. To configure the global routing table in msfconsole, ensure you have run the background
command from within a Meterpreter session:
We can also see, due to the presence of the /.dockerenv
file, that we are in a docker container. By default, Docker chooses a hard-coded IP to represent the host machine. We will also add that to our routing table for later scanning:
Print current routes with
route print
With the previously discovered database credentials and the routing table configured, we can start to run Metasploit modules that target Postgres. Starting with a schema dump, followed by running queries to select information out of the database:
users
What is Santa's password?
p4$$w0rd
What ports are open on the host machine?
To further pivot through the private network, we can create a socks proxy within Metasploit:
From the attacker machine (Kali Linux)
22,80
What is the root flag?
With the password, credentials and proxy setup we can access the server as root
Get meterpreter session here as well and find the flag
Last updated