All categories
Cybersecurity Interview Questions
XSS, CSRF and auth-token attacks: think like an attacker, defend like an engineer.
4 of 4 questions
Topic
Difficulty
Frequency
Round
Type
BeginnerAsked very oftenWeb SecurityConcept round · Concept
How does XSS work, and how do you defend against it?
The browser cannot tell your code from an attacker payload — every XSS defense is about keeping data out of the HTML parser.
Asked atGoogleMetaCloudflare
xsscspsanitization
IntermediateAsked very oftenAuthenticationConcept round · Concept
Why is storing JWTs in localStorage dangerous?
A JWT is a bearer token: one XSS payload that reads localStorage silently walks away with an account that stays valid until expiry.
Asked atStripeAuth0PayPal
jwtlocalstoragehttponly
IntermediateAsked very oftenWeb SecurityConcept round · Concept
How does CSRF work when the attacker cannot read cookies?
The attacker never reads the cookie — the browser volunteers it because cookies follow the destination, not the page that sent you there.
Asked atPayPalStripeGoogle
csrfsamesitecookies
AdvancedAsked sometimesWeb SecurityConcept round · Concept
How does login CSRF work in an OAuth callback?
A signed session ID proves the server made the login URL, not that the browser finishing the login is the one that asked for it.
Asked atStripeGoogleOkta
login-csrfoauth-statesession-fixation