Cross-site scripting

From Simple English Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Cross-site scripting (XSS) is a client-side code injection attack. The attacker aims to execute malicious scripts in a web browser of the victim by including malicious code.

How it works[change | change source]

In a Cross-site Scripting attack (XSS), the attacker uses your vulnerable web page to deliver malicious JavaScript to your user. The user's browser executes this malicious JavaScript on the user's Computer. Note that about one in three websites is vulnerable to Cross-site scripting.

  • Even though a Cross-site Scripting attack happens in the user's browser, it may affect your website or web application. For example, an attacker may use it to steal user credentials and log in to your website as that user. If that user is an administrator, the attacker gains control over your website.
  • To protect against Cross-site Scripting, you must scan your website or web application regularly or at least after every change in the code. Then, your developers must correct the code to eliminate the vulnerability. Contrary to popular opinions, web application firewalls do not protect against Cross-site Scripting, they just make the attack more difficult – the vulnerability is still there.

Types[change | change source]

Non-persistent[change | change source]

Non-persistent XSS vulnerabilities in Google could allow sites to attack Google users who visit them while logged in.

  • The non-persistent (or reflected) cross-site scripting vulnerability is by far the most basic type of web vulnerability.

Persistent[change | change source]

The persistent XSS vulnerability is a more devastating variant of a cross-site scripting flaw: it occurs when the data provided by the attacker is saved by the server, and then permanently displayed on "normal" pages returned to other users in the course of regular browsing, without proper HTML escaping.

Self-XSS[change | change source]

Self-XSS is a form of XSS vulnerability which relies on social engineering in order to trick the victim into executing malicious JavaScript code into their browser.

Mutated XSS[change | change source]

Mutated XSS happens when the attacker injects something that is seemingly safe, but rewritten and modified by the browser, while parsing the markup. This makes it extremely hard to detect or sanitize within the websites application logic.