Web Security: CSRF
- 17Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What does CSRF stand for and what type of attack is it considered?
CSRF stands for Cross-Site Request Forgery, and it is a web attack.
Or swipe the card
17 cards
What does CSRF stand for and what type of attack is it considered?
CSRF stands for Cross-Site Request Forgery, and it is a web attack.
How do web browsers generally handle code they are given to run?
Web browsers are trusting and will run code without judging if it is malicious.
What are the two primary methods for sending data back and forth on the web?
The two primary methods are GET requests and POST requests.
Describe the characteristics of a GET request.
A GET request includes data in the address bar (e.g.,
youtube.com/watch?v=characters) and is primarily designed for fetching data.What is a characteristic of a POST request, and what is its primary purpose?
A POST request bundles data and sends it with the request, but not in the address bar. It is primarily meant for writing or submitting data that happens once.
Why is it important that POST requests are used for actions like submitting a comment or making a transfer, instead of GET requests?
POST requests prevent actions from being repeated by simply refreshing or going back to a page, and they keep sensitive data out of the URL, preventing easy copying and re-execution.
How can a malicious actor exploit a poorly designed online banking form using CSRF?
A malicious actor can create a fake webpage with a hidden form prefilled with a victim's account number and a transfer amount. If the victim is logged into their bank in another tab, clicking a button on the malicious site could trigger an unauthorized transfer.
How do modern web technologies make CSRF attacks potentially more stealthy?
Modern web technologies allow actions to happen silently in the background without reloading the entire page, meaning a user might not even notice a malicious request being fired.
Besides online banking, what other common web application scenario is vulnerable to CSRF if not properly secured?
Actions like deleting an account are vulnerable, especially if they are triggered by a simple GET request to a URL like
/delete?confirm=true.What is the primary reason CSRF attacks succeed in these scenarios?
The success of CSRF attacks stems from the target form not checking where the request originated from.
What HTTP header was originally designed to help prevent CSRF, and how does it work?
The
Refererheader was designed to indicate the URL of the page from which the request was made, allowing the server to check if the request originated from the expected site.Why is relying solely on the
Refererheader problematic for CSRF prevention?The
Refererheader is not always sent reliably, as privacy tools or ad blockers can block it, leading to legitimate users complaining if it's strictly enforced.What is the most effective modern defense against CSRF attacks?
The most effective defense is using a one-time key, often called a nonce (in American English), which is a unique token generated for each form submission.
How does a one-time key (nonce) work to prevent CSRF?
The form on the website generates a unique, random string of characters (token) for each form creation. This token is stored on the server and also embedded invisibly in the form. Any incoming request must include this correct token, ensuring the form originated from the legitimate site.
Why can't a malicious blog simply copy the one-time key from a legitimate form to bypass CSRF protection?
The one-time key changes per user and often per request or after a short time, making it impossible for a malicious site to know or reuse a valid token.
What types of web actions should always be protected with CSRF tokens?
Any permanent actions such as deleting an account, posting a comment, authorizing someone, or transferring money should be protected with CSRF tokens.
Why is Cross-Site Request Forgery (CSRF) often considered a 'lesser-known' web attack compared to XSS and SQL Injection?
CSRF often went under the radar for a long time, and many developers are still unaware of it, unlike the more commonly known XSS and SQL Injection.

Ask anything
We've read this whole study set, so questions about it get the best answers.