P2L12: Web Security Flashcards
What are cookies used for?
To store state - specifically user data
What threats do cookies have?
They can be used as spyware
What is Cross Site Scripting?
It’s where variables are substituted with malicious bits of code. Cookies can be stolen in this manner to help impersonate the user.
How do you defend against XSS?
Clean variables and make sure they aren’t scripts
What is Cross Site Request Forgery? (XSRF)
It’s where malicious code idly sits on a browser and steals cookies from legitimate sites so they can reuse them before they time out to do malicious things.
What are the differences between XSS and XSRF?
- In XSS
- User trusts —> bad implemented website
- Attacker gets script in trusted website
- User’s browser executes the script
- In XSRF
- Bad implemented website —> trusts user
- Attacker tricks browser into issuing requests
- Website executes script
In XSS and XSRF where is each script executed?
XSS - User’s browser
XSRF - Website
In XSS and XSRF who trusts who?
XSS - User trusts badly implemented website
XSRF - Badly implemented website trusts user
In XSS and XSRF how does the attacker attack?
XSS - script is put in trusted website
XSRF - tricks browser to issuing requests
How do you prevent SQL injections?
Sanitize your variables/data and only allow whitelist of acceptable inputs