XSS in Security Testing

Cross site scripting attack (XSS) XSS is the attack in which malicious java script code is injected in to other web sites. When the malicious code is executed in the victim’s browser, sensitive data (e.g. cookies) could be stolen.

Types of XSS attacks

XSS attacks can be categorized into 3 types.
  • Persistent – In these types of attacks, malicious code is stored in the database. So whenever the page gets the data from database, malicious code is executed on the victim’s browser.
  • Non- Persistent – In these types of XSS attacks, malicious code is not stored in the database.
  • DOM scripting

XSS test sites

You can see how XSS attacks are carried out on below test sites.
  • https://www.insecurelabs.org/Talk/Details/1
  • https://www.ryannedolan.info/teaching/cs4830/examples/vulnerability-examples/xss-examples
To set the cookie, you can use below JavaScript.
 
document.cookie=”name=paul;id=2828″;

How to prevent XSS attacks

XSS attacks can be prevented by taking below precautions. Always sanitise the data entered by the user in forms. Do not allows special characters in the HTML forms.

Web development and Automation testing

solutions delivered!!