In this video, we are going to solve low and medium difficulty file upload challenges on dvwa.
File upload vulnerability is a vulnerability in web applications that allows an attacker to upload malicious
files to a server.
These files can then be executed on the server, potentially giving the attacker unauthorized access
to sensitive information.
The ability to execute arbitrary code and the ability to launch further attacks.
The vulnerability typically arises when the application does not properly validate or sanitize the file
being uploaded, allowing the attacker to upload the file with a malicious payload.
So you should be on Kali Linux or Parrot OS in VMware VirtualBox or running natively on your PC.
Now let's see.
Low difficulty file upload challenge.
First of all, go to security settings and set the difficulty to low.
Now create an MSF venom payload on your Kali machine.
Just provide the IP address of your machine and port.
Northern Metasploit and start a multi handler to listen to PHP reverse sessions.
Now upload the file.
The file will be uploaded without any restriction and then you can open the file in the browser.
On opening the file, we will get the reverse shell.
So we are on to.
First of all, change the security level to low.
Move to the file upload tab.
You can view the source and you can see that no sanitization is being performed on file upload.
Now open Metasploit.
Let's first start a multi handler to listen to reverse shells.
Search for handler and you get a number of results.
The multi handler is at number 30.
So use the command.
Use 30 to select the multi handler.
No set payload to listen to PHP reverse shells.
As we are running on our local machine set.
Host to 127.0.0.1.
Gnaw on it.
And our reverse handler will start.
Now let's create a malicious payload.
Use MSF to list all PHP payloads.
We are going to use metropolitan reverse TCP payload.
Use the command MSF venom dash p payload host to our local IP set port.
And output the code in exploit php file.
And our malicious payload has been generated.
No bag on Dvwa.
Click on Browse.
And upload the payload.
You will get the link to the payload.
Just copy the link and paste it in the browser.
And you get a reverse metropolitan shell.
Here you can perform different actions like.
That.
ET cetera.
Now let's delete the payload from the server.
Use the command to remove it.
Now again run multi handler to this one to reverse shells.
For medium difficulty file upload challenge.
Change the difficulty to medium.
Create a venom payload on your Kali machine.
Run metasploit and start a multi handler.
And upload the file.
The file will not be uploaded in medium difficulty.
The server checks for the file content type and if it is not an image, it does not upload it.
Now you need to fire up, burp and try to upload the same shell generated in the previous step and capture
the request in burp.
Now send it to the repeater.
And change the content type of application to image.
And forward the request.
And we will get the reverse shell.
Let's see the demonstration.
First of all, change the security level to medium.
Let's try to upload the generated payload.
And you will get an error.
And if you view the source, you can see that it checks if it's an image or not.
Nevada burp.
Create a new temporary project.
In the proxy tab.
Turn the intercept on.
And set up your browser to use the burp proxy.
No.
Upload the exploit.
Add click upload.
Your request will be captured in burp.
Here.
Change the content type from application to image slash jpeg.
And forward the request.
And our shell will be uploaded.
To copy the URL and paste it in browser.
And you get the reverse shell.
So in this manner we can exploit file, upload vulnerabilities in any website.