The results for OWASP's ZAP has been very useful for eliminating vulnerable parts of my website.
However, I've found a lot of results that I simply cannot fix. For example, one of the get parameters it has put javascript:alert(1);
in to the variable. This variable is then output by PHP in a hidden element's value
attribute. So the final HTML looks like:
<input type="hidden" name="someName" id="someID" value="javascript:alert(1);"/>
This value is normally used to populate a drop down with JavaScript. If it's 1 it shows optional search filters, if 0 it shows nothing. So it's only used in a string comparison that fails.
I see no way for this to be exploited, the alert does not run like other attacks ZAP has shown me. The output is encoded so they cannot inject HTML by ending the quotes or element early with "/>
like previously found attacks, as these characters become their HTML entities counterpart.
Is this just a false positive from ZAP matching the input string in the page source, as encoding javascript:alert(1);
still equals exactly the same as javascript:alert(1);
?
One useful function that's native to JavaScript is the alert() function. This function will display text in a dialog box that pops up on the screen.
Analyze Input Vectors Analyze each input vector to detect potential vulnerabilities. To detect an XSS vulnerability, the tester will typically use specially crafted input data with each input vector. Such input data is typically harmless, but trigger responses from the web browser that manifests the vulnerability.
XSS attacks may be conducted without using <script>...</script> tags. Other tags will do exactly the same thing, for example: <body onload=alert('test1')> or other attributes like: onmouseover , onerror .
The vulnerability means that ZAP managed to insert arbitrary code into that input field. This means that you're most likely not validating user input somewhere in the app.
You should be more careful about generating that input field, and ensure that the GET parameter(s) used to generate it are validate accordingly.
Remember, it's better to be safe, than sorry (i.e. have your app compromised).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With