Help - Cross Site Scripting (Stored)

"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.

The XSS is stored in the database. The XSS is permanent, until the database is reset or the payload is manually deleted.




Objective

Redirect everyone to a web page of your choosing.




Low Level

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

Spoiler: Either name or message field: <script>alert("XSS");</script>.

Medium Level

The developer had added some protection, however hasn't done every field the same way.

Spoiler: name field: <sCriPt>alert("XSS");</sCriPt>.

High Level

The developer believe they have disabled all script usage 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: