Reconstruction
Gaining Access
Nmap scan:
Anonymous FTP -> Wireshark Password
FTP allows anonymous logins:
note.txt
mentions that there are passwords within the files:
Most of the PCAP files contained traffic generated from brute forcing the site, so it was pretty tedious looking through all of them. The 30.04.2020
PCAP file contained a lot of brute force attempts, while 1.05.2020
contained very few:
And within that PCAP file, we can find a request that has a password that seems to work:
Web Enum -> LFI
Port 8000 hosted the same Flask application:
With the password we found earlier, we can login:
Attempting to view the 'Hello World' blog entry results in an error from Flask:
There's a feature within this kind of web application that allows us to access the console to run Python code, but this one is protected by the PIN:
I ran a directory scan using wfuzz
:
There were just these 3 directories. create
is pretty obvious in what it does, but data
was not. Visiting it just shows this:
Testing any directories with this shows the same page, but with a new header:
The X-Error
showing Incorrect Padding
is present, and when googled the first thing that comes up is base64
:
If we use the base64
encoded string of /etc/passwd
, we get another unique error:
Now there's an error saying there's no file or directory triggered by the newline character. This means we have LFI on the server if we use echo -n
!
Werkzeug PIN Calculation -> RCE
Since we have LFI on the Werkzeug server, we can actually calculate the PIN required.
Using our LFI, we can get the parameters required. First, we need to get the ARP Address of the machine. First, we can find the ARP cache to identify the interface used:
ens160
is the interface name needed to find the ARP address:
Convert this to decimal using python
:
Next, we need to get the machine ID.
The machine ID needed some service name appended to the back of it, which we can get from reading /proc/self/cgroup
.
We also need the user that started the application, which can be found in /proc/self/environ
:
Afterwards, I tested it a few times, varying the public bits and testing the machine ID with and without blog.service
appended to the end of it and eventually got it:
From here, we can easily get a reverse shell on our machine.
We cannot read the user flag yet.
Privilege Escalation
Jack Creds
Within app.py
for the Flask website, we can find some credentials:
We can su
to jack
using the commented password.
Powershell -> Root Creds
Within the home directory of the user, I enumerated the directories present and noticed that there was a Powershell directory:
Obviously this was rather odd. If we read the ConsoleHost_History.txt
file at the end of it, we find this:
This password can be used to su
to root
:
Last updated