Stored XSS


Stored XSS (Cross Site Scripting)

By Rohit Gautam
Stored XSS (Cross Site Scripting)
    

Summary: Stored XSS (Cross-Site Scripting) is a web security vulnerability that occurs when an application allows untrusted data to be stored permanently on the server and later displayed to users without proper validation or sanitization. By exploiting this vulnerability, attackers can inject malicious scripts that are executed when users access the affected page, leading to the theft of sensitive information, session hijacking, or unauthorized actions.

Severity: High

Attack Vector: Remote

Complexity: Medium

Impact: By successfully exploiting Stored XSS, attackers can manipulate the browsing experience of users, steal user credentials, perform actions on behalf of the user, distribute malware, or deface the website.

Affected IP Address: https://www.example.com/

Port: 443

Steps to Reproduce:

1. Identify the target web application vulnerable to Stored XSS.
2. Analyze areas of the application where user-supplied data is stored and later displayed to users.
3. Craft a malicious script payload, including JavaScript or other scripting code, to be injected into the vulnerable input field or data storage.
4. Inject the crafted payload into the vulnerable input field or storage mechanism and save it.
5. Access the page or trigger the action that displays the stored data and observe if the injected script is executed in the user's browser.

Recommendations:

To mitigate Stored XSS vulnerabilities, consider the following recommendations:
1. Implement proper input validation and sanitization on all user-supplied data before storing it.
2. Use output encoding or context-aware output escaping when displaying user-supplied data to prevent script execution.
3. Implement a strong Content Security Policy (CSP) to restrict the execution of untrusted scripts and enforce strict source whitelisting.
4. Regularly update and patch web application frameworks, libraries, and dependencies to address any known XSS vulnerabilities.
5. Educate developers about secure coding practices and the risks associated with XSS attacks, including input validation, output encoding, and input context awareness.

References: 

1. OWASP - Cross-Site Scripting (XSS): https://owasp.org/www-community/attacks/xss/ 
2. PortSwigger - Cross-Site Scripting (XSS): What is stored XSS (cross-site scripting)? Tutorial & Examples | Web Security Academy (portswigger.net)

Proof of Concept:

Please refer to the attached screenshot or video for a visual demonstration of a Stored XSS vulnerability.