This project demonstrates common web application security vulnerabilities and their secure implementations.
server.js- Vulnerable server with intentional security flaws for educational purposessafe_server.js- Secure implementation showing proper security practices
- Location:
server.jslines 20-28 - Issue: User input is directly inserted into HTML without sanitization
- Test payload:
<script>alert('xss')</script> - Impact: Malicious scripts can be executed in users' browsers
node server.jsNavigate to http://localhost:3000 and try the XSS payload.
node safe_server.jsNavigate to http://localhost:3000 to see the secure implementation.
Students will learn:
- How XSS vulnerabilities occur
- The importance of input validation
- Output encoding techniques
- Content Security Policy (CSP) implementation
- Secure coding practices
- Input validation and sanitization
- Output encoding
- Content Security Policy headers
- Proper error handling
- Security headers implementation
This project is designed for security training and educational purposes. The vulnerable code is intentionally left unfixed to demonstrate real-world security issues.