Help - Cross Site Scripting (Reflected)

About

"Cross-Site Scripting (XSS)" attacks are a type of injection problem, in which malicious scripts are injected into the otherwise benign and trusted web sites. XSS attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application using input from a user in the output, without validating or encoding it.

An attacker can use XSS to send a malicious script to an unsuspecting user. The end user's browser has no way to know that the script should not be trusted, and will execute the JavaScript. Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by your browser and used with that site. These scripts can even rewrite the content of the HTML page.

Because its a reflected XSS, the malicious code is not stored in the remote web application, so requires some social engineering (such as a link via email/chat).




Objective

One way or another, steal the cookie of a logged in user.




Low Level

Low level will not check the requested input, before including it to be used in the output text.

Spoiler: ?name=<script>alert("XSS");</script>.

Medium Level

The developer has tried to add a simple pattern matching to remove any references to "<script>", to disable any JavaScript.

Spoiler: Its cAse sENSiTiVE.

High Level

The developer now believes they can disable all JavaScript by removing the pattern "<s*c*r*i*p*t".

Spoiler: HTML events.

Impossible Level

Using inbuilt PHP functions (such as ""), its possible to escape any values which would alter the behaviour of the input.


Reference: