-
09-12-2012, 05:11 PM #1Super Commando Dhruv


- Join Date
- Sep 2010
- Location
- Lucknow/Pune,India
- Posts
- 469
- Blog Entries
- 2
- Thanks
- 169
- Thanked 144 Times in 83 Posts
BuYS: Web attack for information disclosure of source code
We all are pretty much familiar with the notorious %00.
By adding %00 at endCode:http://www.example.com?page=index.php
This throws out the source code of index.phpCode:http://www.example.com?page=index.php%00
Q.1 What is this attack called ?
Q.2 Why does this work or what are the internal flaws in web languages which leads it to leak it.
Q.3 How can this be mitigated.(You can assume PHP to be the language. Or you can answer for other languages as well)
PM me the answers within 3 days. All answers with solution will be posted after 3 days completion.Last edited by abhaythehero; 09-12-2012 at 05:18 PM.
In the world of 0s and 1s, are you a zero or The One !
-
09-13-2012, 09:22 AM #2Garage Hyper Addict


- Join Date
- Jul 2010
- Location
- irc.freenode.net #g4h
- Posts
- 644
- Thanks
- 140
- Thanked 270 Times in 109 Posts
Answer pmed Super Commando Dhruv. Not a complete one, but whatever I knew about this attack vector.
Cheers![*] To follow the path: look to the master, follow the master, walk with the master, see through the master,
------> become the master!!! <------
[*] Everyone has a will to WIN but very few have the will to prepare to WIN
[*] Invest yourself in everything you do, there's fun in being serious
-
09-13-2012, 11:43 AM #3Super Commando Dhruv


- Join Date
- Sep 2010
- Location
- Lucknow/Pune,India
- Posts
- 469
- Blog Entries
- 2
- Thanks
- 169
- Thanked 144 Times in 83 Posts
-
09-18-2012, 04:31 PM #4Super Commando Dhruv


- Join Date
- Sep 2010
- Location
- Lucknow/Pune,India
- Posts
- 469
- Blog Entries
- 2
- Thanks
- 169
- Thanked 144 Times in 83 Posts
Oops made a mistake in the scenario....
Here is the correction :
(Here we are getting an html output. We assume that 1.html file is there on server and is being acessed.)Code:http://www.example.com?page=1
By adding %00 at end
This throws out the source code of page.phpCode:http://www.example.com?page=page.php%00
________________________________________________
Another 3 days
In the world of 0s and 1s, are you a zero or The One !
-
10-05-2012, 04:39 PM #5Super Commando Dhruv


- Join Date
- Sep 2010
- Location
- Lucknow/Pune,India
- Posts
- 469
- Blog Entries
- 2
- Thanks
- 169
- Thanked 144 Times in 83 Posts
b0nd's answer :
----------------------------------------------------------------------------Not sure about %00 disclosing source code of the page but, to the best of my memory, it does help in commenting out the extension part of file (back door shells) and hence in their execution. Have seen practical usage when uploading of shells like xyz.php but filters doesn't allow extensions other than txt, jpg etc.
Solution used to be to rename xyz.php to xyz.php.txt and upload and then run on browser as /path/xyz.php%00.txt
Ans 1. Poison NULL byte attack. Full paper http://insecure.org/news/P55-07.txt
Ans 2. PHP,Perl,etc allows NULL characters in its variables as data. Unlike C, NULL is not a string delimiter. So, "root" != "root\0". But, the underlying system/kernel calls are programmed in C, which DOES recognize NULL as a delimiter. So the end result? PHP passes "index.php%00", but the underlying libs stop processing when they hit the first (our) NULL. Hence index.php%00 is meant by php code, but C library understands it as index.php. So the code of index.php is coughed(as would happen in case of 1.html file) on page and not considered by server side code to be executed.
Ans 3. Apply regex to filter out null. (Read the paper, it is explained in detail there)Last edited by abhaythehero; 10-05-2012 at 04:51 PM.
In the world of 0s and 1s, are you a zero or The One !



LinkBack URL
About LinkBacks



Reply With Quote

i am a secret hacker with all...
05-22-2013, 09:35 PM in Noobs Corner