Why don't you help Animal?

Thursday, October 18, 2012

How to do Local File inclusion?

Local File inclusion is a common website hacking trick. This tutorial will show you how to exploit a website using L.F.I.
First of all, take a look on the given php code.

The above given code is generally used in many website by web developers which should not
be use because the $page isn't sanitized and is passed directly to the webpage. This code is used by hackers for L.F.I.

In general, you have seen many URL's like thishttp://www.site.com/index.php?page=products.php
the value passed through the query string is used to include products.php page by the above given php code without checking the proper format of value inserted at URL.
suppose we inserted the URL like this..
this mypage.php does not exists on the server so it will show a php error message on the webpage..
Warning: include() [function.include]: Failed opening 'mypage.php' for inclusion.........
here we go..
we know this is vulnerable.
If this website is hosted on a unix server, then we might be able to do a directory transversal to the password file.
The etc/passwd is where the users/passwords are storedhttp://www.mywebsite.com/index.php?page=../etc/passwd

try adding ../ till you get access to the passwd file..
here note one thing.
if the URL is like this.

You can also view


these files will also give you some useful informations of the server system.

No comments:

Post a Comment