Cross Site Scripting (XSS) - Stored
Summary
sXSS enables attackers to inject malicious JavaScript code into a web application's database, which is then later reflected to other users, posing risks of unauthorized actions, data manipulation, and potential security breaches.
Testing methodology
Description
Stored Cross Site Scripting (sXSS) is a vulnerability that occurs when user-supplied input is stored by a web application and later displayed to other users without proper sanitization. An XSS vulnerability is defined as Stored in cases where the malicious code is stored in the application's database, in which case, the application will display the malicious value to users regularly.
Attackers can exploit this vulnerability by injecting malicious scripts, which are executed by unsuspecting users' browsers, leading to potential theft of sensitive information, session hijacking, or unauthorized access.
Remediations
- Validate all user inputs on the server side, ensuring that they meet the application's data requirements and expectations. This includes both alphanumeric validations as well as format validations.
- Encode user-supplied output when it's incorporated into HTML. This makes potentially harmful input safe to display. HTML Entities can be used to safely represent characters, avoiding script interpretations.
- Fewer XSS bugs appear in applications built with modern web frameworks like React that help mitigate against XSS using templating, auto-escaping and more. However, ensure developers aren't bypassing those same framework benefits by dangerous methods ignoring the framework's default protections.
Usually follows
Usually precedes
Affected components
- Server
- Client Side