Escape (WIP)


sudo nmap -p- -sS -sV

22/tcp   open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
80/tcp   open  http    Apache httpd 2.4.29 ((Ubuntu))
8080/tcp open  http    Apache httpd 2.4.38 ((Debian))
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

The directory page /dev/index.php allows for GIF uploads. Attempting to upload a different file type will be rejected.

This can be bypassed by first upload a legitimate GIF file. I used a small GIF such as the following:

Upload the file and capture the request with Burpsuite. The request when attempting upload should look something similar to the image below:

We now need to send the request to repeater so we can edit it and inject a PHP reverse shell. In the request below I have ensured the filename ends in '.php' and the first line of the original request has been kept in as these are magic bytes which are used to identify what type of file is being upload. As far as the server is concerned because the line starting with: GIF89aƈ* exists in the request then the file must be a GIF.

Ensure the following is still set: Content-Type: image/gif Then under the magic byte sequence we can inject a PHP Reverse shell.

Once completed send the request on and check to see if uploaded.

Once uploaded start a netcat listener and browse to the following:

A shell should be received as www-data.

Last updated