This article is a part of our Web Security Knowledge Base (back to index)

Why “Cross Site Scripting (Reflected)” can be dangerous

Cross site scripting is an attack where a web page executes code that is injected by an adversary. It usually appears, when users input is presented. This attack can be used to impersonate a user, take over control of the session, or even steal API keys.

The attack can be executed e.g. when you application injects the request parameter directly into the HTML code of the page returned to the user:

what results in:

<span>Confirmation: Transaction Complete</span>

In that case the message can be modified to become a valid Javascript code, e.g.:<script>dangerous javascript code here</script>

and it will be executed locally by the user's browser with full access to the user's personal application/browser data:

<span>Confirmation: <script>dangerous javascript code here</script></span>

How to fix “Cross Site Scripting (Reflected)”

To avoid XSS attacks, ensure that user inputs are escaped and validated. Note that client-side check could be bypassed. Consider using Content Security Policy and HttpOnly cookies. If using CMS use one with an automatic encoding option. Be careful when writing JS scripts, eval and Function could be potential attack vector, if data is not escaped/validated. Avoid redirects under user control.

How does ScanRepeat report “Cross Site Scripting (Reflected)”

ScanRepeat verifies if this is feasible to insert client side script.

Would you like to test your application now against this problem? Sign up for our free trial

Scan Your Web App Now
Scan your application
for 14 days for free

No credit card is required. No commitment.

Sign Up Free