Practitioner Lab 9: Web shell upload via extension blacklist bypass

 


This lab contains a vulnerable image upload function. Certain file extensions are blacklisted, but this defense can be bypassed due to a fundamental flaw in the configuration of this blacklist.

To solve the lab, upload a basic PHP web shell, then use it to exfiltrate the contents of the file /home/carlos/secret. Submit this secret using the button provided in the lab banner.

You can log in to your own account using the following credentials: wiener:peter

to start this lab I logged in as wiener





This lab took me longer than I wanted. I didn’t understand how .htaccess worked very well but After doing some research I learned how it all worked and how it gives configurations for a particular directory.



I knew it was an apache server because when I first did the post request it told me it was apache.

I went and made an .htaccess file



This file basically tells the server that if it sees any .php5 to then run that file as if it was a php file.

When I initially uploaded this I made the mistake of uploading it using the ../ because I thought it needed to be in the previous directory. But after doing more research I found out that it needs to be in the same directory.



Here I am uploading the .htaccess file with the rule.



Here I uploaded a .php5 file that would then be executed by the server as if it was a php file.



I then saw this request which I used to execute the script. I sent this to repeater and there I executed the script



Here the content was executed correctly and I got the flag



The lab is now Done.

I found this lab pretty tricky simply because even though I knew about .htaccess I didn’t fully understand how to use it. But now I have learned and hopefully won’t struggle as much with these labs.

Comments

Popular posts from this blog

Active Directory Home Lab

Vulnerability Management(Nessus)

TightVNC and Colasoft Packet Builder Lab

Practitioner Lab 2: File path traversal, traversal sequences stripped non-recursively