18. Web security: client-side attacks Flashcards
What is session hijacking?
Exploitation of a valid computer session (to gain unauthorised access)
What does CSRF stand for?
Cross-site request forgery
What is a CSRF attack?
Forces a user to execute an unwanted action, targets state-change requests since attacker cant see responce
How do you defend against CSRF? (3)
- Check referrer (ensure request comes from original site)
- Include CSRF token in forms (request becomes unpredictable, can’t be forged)
- Set SameSite attribute on cookie (prevents cookies being sent in cross-site requests)
What is the origin
The scheme, host and port of a URL
What is the same origin policy?
SOP restricts access to DOM to scripts loaded from the same origin
What does XSS stand for?
Cross-site scripting
What is an XSS attack?
Malicious scripts are injected into a trusted web site
What are the two types of XSS attack?
- Stored
- Reflected
What is a stored XSS attack?
Injected script permanently stored on target server (database, forum message, etc)
What is a reflected XSS attack?
Injected script is reflected off the web server (error message, search result, other response containing user input)
How do you defend against XSS?
- Escape/filter output
- Validate input
- CSP, server whitelists scripts that can appear on page