我正在尝试学习渗透测试,并且我下载了一个名为“Bodgeit Store”的易受攻击的应用程序。除了执行跨站点脚本攻击之外,我已经完成了几乎所有的挑战。我查看了应用程序的源代码,发现以下 Java 代码:
if (request.getMethod().equals("POST") && comments != null)
{
anticsrf = request.getParameter("anticsrf");
if (anticsrf != null && anticsrf.equals(request.getSession().getAttribute("anticsrf")))
{
// Strip script tags, because that will make everything alright...
comments = comments.replace("<script>", "");
comments = comments.replace("</script>", "");
// And double quotes, just to make sure
comments = comments.replace("\"", "");
.................
}
}
挑战说:
“使用以下方式显示弹出窗口:
<script>alert("XSS")</script>”
但是查看源码我们发现<script>and</script>标签被空字符代替了。此外,我无法发出 GET 请求,因为代码还会验证请求是否为 POST 请求。
我已经尝试并成功地使用其他方法(例如使用外部 .js 文件等)执行警报框,但我真的很想找到如何完成这一挑战。请给我一些关于如何解决这个问题的建议。