API Fundamentals
/Intermediate
XSS
Definition
Cross-Site Scripting. A vulnerability where an attacker injects malicious client-side scripts into web pages viewed by other users.
Explain Like I'm New
If an API allows a user to type their name, and they type `<script>stealCookie()</script>`, and the API saves it. When other users visit the site, the browser sees the `<script>` tag, thinks it's part of the website code, and executes it, stealing their passwords.
Real World Example
A hacker puts a malicious script in a YouTube comment. The API returns the comment to 1,000 users. Their browsers execute the script, which secretly commands their accounts to 'Like' the hacker's video.
Common Use Cases
- •Input sanitization
- •Frontend security
Interactive Example
Loading...
Console output will appear here...
Interview Questions
basic
- Does the XSS exploit execute on the Backend Server or the Frontend Browser?
intermediate
- How do modern frontend frameworks like React protect against XSS by default?