BACK TO TOPICS
Intermediate

Cross-Site Scripting (XSS)

1. The Mechanics of XSS

Cross-Site Scripting (XSS) is a code injection attack where an attacker executes malicious JavaScript in a victim's browser. It is one of the most prevalent web vulnerabilities.

Why is it dangerous?

JavaScript has access to the DOM (Document Object Model), including:

  • Cookies: Session IDs (if not HttpOnly).
  • Local Storage: JWTs, user data.
  • Forms: Can intercept keystrokes (keylogging).
  • Network: Can make HTTP requests on behalf of the user (CSRF).

Essentially, if an attacker can run JS on your site, they are the user.

Module Progress

1The Mechanics of XSS
2Stored XSS (Persistent)
3Reflected XSS (Non-Persistent)
4DOM-based XSS
5Prevention Strategies
Progress20%