![]() |
Understanding LFI and RFI Attacks
Local File InclusionLocal File Inclusion ( LFI ) is a method of including files on a server through a Modified Special HTTP request. This vulnerability can be exploited using a Web Browser and thus can be very easy to exploit. The vulnerability occurs when a user supplied data without sanitizing is provided to an ‘inclusion type’ (like , include() , require() etc.) . Mostly these attacks are accompanied by Directory Transversal attacks which can reveal some sensitive data leading to further attacks. Now that’s quite a bit of theory there let’s have a look on a sample vulnerable application. Demonstration [Proof of Concept]I have created a pair of files named index.html and lfi.php lfi.php Code:
<html>index.html Code:
<p>Hello I am a sample page my name is index.html</p>First let’s try and give this app a normal input which it would be expecting. Input: index.html Output:- Code:
Welcome to this WebsiteConstructing the attack string As I am working on UNIX we’ll print out the contents of /etc/passwd file , The file /etc/passwd is a local source of information about users' accounts. My present working directory is /var/www/ , So what I have to do is :-
Attack string :- Code:
../../etc/passwdInput: “ ../../etc/passwd” Code:
Welcome to this WebsiteRemote File InclusionRFI is an abbreviation for Remove File Inclusion and is quite similar to LFI, Remote File Inclusion ( RFI ) is a method of including Remote files(present on another server) on a server through a Modified Special HTTP request. This vulnerability can be exploited using a Web Browser and thus can be very easy to exploit. The vulnerability occurs when a user supplied data without sanitizing is provided to an ‘inclusion type’ (like, include (), require () etc.) Demonstration [Proof of Concept]We’ll be using the same sample web-app we used to Demonstrate LFI Constructing the attack string:- In our case we want to include go4expert’s index file in our local file. So what we have to do is, simply provide the URI as an input and see what happens Input : http://go4expert.com Output (page source):- Code:
<html>Note: In most modern ‘php.ini’ files, allow_url_include is set to off which would not allow a malicious user to include a remote file. That’s all for this tutorial stay tuned for more! |
Re: Understanding LFI and RFI Attacks
what can i do i9 can,t under what i m doing:worried::worried::worried::worried:
|
Re: Understanding LFI and RFI Attacks
Quote:
|
| All times are GMT +5.5. The time now is 00:27. |