Contacts

XSS Attack training. XSS Vulnerability - What is it? Examples of XSS vulnerabilities. Data from filled forms

Intersype scripting (XSS) is a vulnerability that is to implement the code executable on the client side (JavaScript) in the web page that other users are brought.

Vulnerability arises due to insufficient data filtering, which the user sends to insert into a web page. It is much easier to understand specific example. Remember any guestbook - These are programs that are intended to accept data from the user and the subsequent display. Imagine that the guestbook does not check in any way and does not filter entered data, but simply displays them.

You can sample your own simpler script (There is nothing easier than writing bad scripts on PHP - this is very involved in this). But there are already plenty of ready-made options. For example, I propose to start an acquaintance with Dojo and Owasp Mutillidae II. There is a similar example. In the stand-alone Dojo environment, go to the browser by reference: http: //localhost/mutillidae/index.php? Page \u003d Add-to-Your-Blog.php

If someone from users entered:

That web page will display:

Hey! Like your site.

And if the user enters this:

Hey! Like your site.

That will be displayed like this:

Browsers keep a set of cookies large number sites. Each site can get cookies only saved to them. For example, the Example.com website has retained some cookies in your browser. You are the crash to the site of Another.com, this site (client and server scripts) cannot access Cookies that the EXAMPLE.COM website has saved.

If the site example.com is vulnerable to XSS, then this means that we can in one way or another to implement the JavaScript code into it, and this code will be executed on behalf of the site example.com! Those. This code will receive, for example, access to Cookis site example.com.

I think everyone remembers that JavaScript is executed in user browsers, i.e. With the presence of XSS, embedded malicious code Gets access to the user data that opened the website page.

The embedded code is able to all that JavaScript can, namely:

  • access to the Cookies of the viewed site
  • can make any changes in appearance pages
  • access to the exchange buffer
  • can implement programs on javascript, for example, ki-loggers (pushed key interceptors)
  • touch on Beef.
  • and etc.

The simplest example With Cookiz:

Actually, alert. Used only to detect XSS. Real malware payloads hidden actions. It is hidden binds to a remote intruder server and transmits stolen data on it.

Types of XSS.

The most important thing is that you need to understand about the types of XSS what they happen:

  • Stored (constant)
  • Reflected (non-permanent)

Example of permanent:

  • An attacker introduced a specially formed message to the guest book (comment, forum message, profile) which is stored on the server, loaded from the server each time users request the display of this page.
  • The attacker received access to the server data, for example, via SQL injection, and introduced to the user-called data for malicious JavaScript code (with KI-loggers or with Beef).

Sample of non-permanent:

  • The site has a search, which, together with the search results, shows something like "you were looking for: [search string]", while the data is not filtered properly. Since such a page is displayed only in order to have a link to it, while the attacker will not send the link to other users of the site, the attack will not work. Instead of sending a reference to the victim, you can use the placement of a malicious script on a neutral site that visits the victim.

Still stand out (some as a kind of non-permanent XSS vulnerabilities, some say that this species can be a variety of constant XSS):

  • DOM model

Features XSS based on DOM

If you are completely simple, the malicious code "ordinary" non-permanent XSS can be seen if you open the HTML code. For example, the link is formed in this way:

Http://example.com/search.php?q\u003d "/\u003e

And when opening the original HTML code, we see something like this: