How amribrahiim/xss-csrf-lab works
This is a local PHP security-training lab demonstrating stored XSS, CSRF protection, and how same-origin script execution can undermine that protection. The principal flow is a user storing a Bio on their profile, another authenticated user viewing it, and the documented script-driven email-change chain; the app also offers a vulnerable email-change comparison. Source excerpts show profile, session, endpoint, and JSON-store behavior. The browser-side attack script is documented but not present in the tree, so that link is shown as unverified.
Main entry points: db.php User Data Access · profile.php Profile View and Edit · session.php Session and CSRF · change_email.php Protected Email Change
Components 9
Identity and Sessions
- Login
login.php - Session and CSRF
session.php
Profiles and XSS
- Profile View and Edit
profile.php
Email Change
- Protected Email Change
change_email.php - Unprotected Email Change
change_email_vuln.php
User Storage
- User Data Access
db.php - User Records
data/users.json
Other components
- User Browser
- Attacker
Connections 17
- User Browser → Login: submits credentials
login.php - Login → Session and CSRF: sets login session
login.php - Login → User Data Access: looks up user
login.php - User Browser → Profile View and Edit: views or edits
profile.php - Profile View and Edit → Session and CSRF: requires login
profile.php - Profile View and Edit → User Data Access: reads and updates
profile.php - Session and CSRF → User Data Access: loads current user
session.php - User Data Access → User Records: reads and writes
db.php - User Browser → Protected Email Change: submits email form
change_email.php - Protected Email Change → Session and CSRF: checks login and token
change_email.php - Protected Email Change → User Data Access: updates email
change_email.php - User Browser → Unprotected Email Change: submits email form
change_email_vuln.php - Unprotected Email Change → Session and CSRF: requires login
change_email_vuln.php - Unprotected Email Change → User Data Access: updates email
change_email_vuln.php - Attacker → Profile View and Edit: stores Bio payload
README.md - Profile View and Edit → User Browser: renders raw Bio
profile.php - User Browser → Protected Email Change: script obtains token and submits
README.md