Nmap

PORT   STATE  SERVICE  VERSION
20/tcp closed ftp-data
21/tcp open   ftp      vsftpd 3.0.3
80/tcp open   http     Apache httpd 2.4.41
| http-methods: 
|_  Supported Methods: HEAD GET POST OPTIONS
|_http-title: 403 Forbidden
|_http-server-header: Apache/2.4.41 (Ubuntu)

Enumeration

We get a 403 Forbidden on port 80
We can try to brute force FTP with some common default creds.

┌──(kali㉿kali)-[~]
└─$ hydra -C /usr/share/seclists/Passwords/Default-Credentials/ftp-betterdefaultpasslist.txt 192.168.132.183 ftp

user:system

The backup file is a pcap (discovered by running file backup).

Imported into Wireshark. There is a lot of junk, but there are also a few HTTP packets that show us that there is an upload feature at /exiftest.php.

The parameter is myFile (see screenshot). It is running exiftool.

There is a vulnerability for Exiftool that we can exploit to upload a malicious jpg
We can upload based on what we know from reading the /exiftest.php page.

In the curl command, the **`@` character tells curl to read and upload the contents of a local file** instead of treating the argument as a plain text string.

When you use the -F (or --form) flag, curl emulates a user filling out an HTML form and submitting it via an HTTP POST request.

Here is how curl interprets the syntax with and without the @ symbol:

With @ (myFile=@./image.jpg): curl opens the file image.jpg at the specified path, reads its binary data, and uploads it as an actual file. It automatically sets the correct form headers (like filename="image.jpg" and an appropriate Content-Type) so the receiving server (in this case, exiftest.php) recognizes it as an uploaded file.

Without @ (myFile=./image.jpg): curl treats ./image.jpg as a literal string of characters. Instead of uploading the image, it will literally send the text text data ./image.jpg as the value of the myFile form field.

Privilege Escalation

Ran linpeas, and found that pkexec is vulnerable to PwnKit
https://github.com/joeammond/CVE-2021-4034/blob/main/CVE-2021-4034.py

Transferred exploit to target, ran, root, proof.txt. Done.