I am trying to learn penetration testing and I have downloaded a vulnerable application called "Bodgeit Store". I have finished almost all the challenges except one which is to execute a Cross-Site Scripting attack. I looked through the source code of the app and found the following Java code:
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("\"", "");
.................
}
}
The challenge says:
"Display a popup using:
<script>alert("XSS")</script>
"
but looking at the source, we find that the <script>
and </script>
tags are replaced by null characters. Also I cannot make a GET request because the code also verifies whether the request is a POST request or not.
I have tried and succeeded in executing an alert box using other methods like using an external .js file and so, but I really want to find how one could complete this challenge. Please give me some suggestions on how to go about solving this one.
'
instead of"
: <script >alert('XSS')</script > There are also plenty other methods.