This repository contains a vulnerable React.js application intentionally designed for educational and security testing purposes. The application includes common web vulnerabilities such as NoSQL Injection, Cross-Site Scripting (XSS), Open Redirect, and Session Management Issues.
Disclaimer: This project is for learning and demonstration purposes only. Do not deploy this application on public servers or use it in production environments.
- Description: The application allows malicious queries in API endpoints, enabling NoSQL injection attacks.
- Example Exploit:
{ "username": { "$ne": null }, "password": { "$ne": null } }
- Description: User input is directly rendered into the DOM without sanitization.
- Example Exploit:
<script>alert('XSS Exploit');</script>
- Description: Redirect logic accepts unvalidated URLs, allowing attackers to redirect users to malicious websites.
- Example Exploit:
https://example.com/redirect?redirect=http://malicious.com
- Description: Sessions are managed using insecure methods such as localStorage without expiration or secure flags.
- Example Exploit:
- Lack of token expiration.
-
Clone the Repository:
cd vulnerable-react-app -
Install Dependencies:
npm install
-
Start the Application:
npm start
-
Access the Application: Open http://localhost:3000 in your browser.
- For nosql:
cd /backend
node server.js- Use common penetration testing tools like Burp Suite, OWASP ZAP, or Postman.
- Perform manual tests to identify vulnerabilities.
- Inject payloads in input fields to test for XSS, NoSQL Injection, and Open Redirects.
- Understand common web application vulnerabilities.
- Learn about secure development practices.
- Practice using security testing tools.
-
NoSQL Injection Prevention:
- Use parameterized queries.
- Validate and sanitize all input.
-
XSS Prevention:
- Use libraries like
DOMPurify. - Escape user-generated content.
- Use libraries like
-
Open Redirect Prevention:
- Validate and restrict redirect URLs.
- Use a whitelist of allowed domains.
-
Session Management Security:
- Use
httpOnlyandsecureflags for cookies. - Implement token expiration and refresh mechanisms.
- Use
- Feel free to open issues or submit pull requests for improvements.
This project is licensed under the MIT License. See the LICENSE file for details.
Important Notice: Use this project responsibly. Do not use the code or knowledge gained from this repository for malicious activities. The authors are not responsible for any misuse of this application.