|What is XSS (Cross-Site Scripting)?|
XSS may be a very commonly exploited vulnerability type which is extremely widely spread and simply detectable and also it’s one among the important vulnerability in OWASP TOP 10.
|Typical XSS Attack.|
What is XSS Attack( Cross-Site Scripting )?
- Reflected XSS
- Stored XSS
- DOM-Based XSS
In Reflected XSS, an attacker sends the victim a link to the target application through email, social media, WhatsApp media, etc. This link features a script embedded within it which executes when visiting the target site.
In Stored XSS, the attacker is in a position to plant a persistent script within the target website which can execute when anyone visits it.
Here is a simple example of a stored XSS vulnerability. A message board application lets users submit messages, which are displayed to other users:
<p>Hello, this is my message!</p>
The application doesn’t perform any other processing of the data, so an attacker can easily send a message that attacks other users:
<p><script>/* Bad stuff here... */</script></p>
With DOM Based XSS, no HTTP request is required, the script is injected as a result of modifying the DOM of the target site within the client-side code within the victim’s browser and is then executed.
Potential risks about Cross-Site Scripting OWASP Top 10
The attacker can compromise or take over the victim’s user account within the application. they might retrieve data from the target web application, modify content on the target page, redirect the victim to a different malicious or spoof site, or use it as a platform to put in other malware on the victim’s system.
The consequences of any of the above can seriously impact your ability to conduct business, your customers, and your organization’s reputation.
Defences against Cross-Site Scripting
- What input can we trust?
- Does it adhere to expected patterns?
- Never simply reflect untrusted data.
- Applies to data within our database too.
- Encoding of context(Java/attribute/HTML/CSS).
Check out our other post here.