Intermediate Understanding of Cross-Site Request Forgery (CSRF)
Assess your knowledge of CSRF attacks and defenses in web applications.
Questions in this quiz
12 questions on Intermediate Understanding of Cross-Site Request Forgery (CSRF). Work through them here, then start the quiz to answer them and see your score.
1.What is the primary goal of a CSRF attack?
- ATo inject malicious scripts into a webpage
- BTo steal user credentials
- CTo encrypt user data for ransom
- DTo execute unauthorized commands on behalf of a user
2.Which of the following is a common method to prevent CSRF attacks?
- AImplementing CAPTCHA
- BUsing HTTP-only cookies
- CIncluding a CSRF token in requests
- DEnabling CORS
3.How does the SameSite cookie attribute help mitigate CSRF attacks?
- ABy setting cookies to expire quickly
- BBy making cookies read-only
- CBy encrypting cookies
- DBy restricting cookies to same-site requests
4.Which HTTP method is most vulnerable to CSRF attacks?
- AGET
- BPOST
- CPUT
- DDELETE
5.Why is it important to validate the origin of a request in CSRF prevention?
- ATo improve request performance
- BTo ensure the request is from a trusted source
- CTo encrypt the request data
- DTo log the request details
6.Which of the following is NOT a characteristic of a CSRF token?
- APredictable
- BIncluded in requests
- CUnique per session
- DSecret
7.What role does user authentication play in CSRF attacks?
- AIt encrypts CSRF tokens
- BIt is irrelevant to CSRF
- CIt prevents CSRF by default
- DIt can be exploited by CSRF to perform actions
8.How does the Referer header help in CSRF prevention?
- ABy validating user credentials
- BBy encrypting the request
- CBy indicating the source of the request
- DBy making cookies secure
9.What is a limitation of using the Referer header for CSRF protection?
- AIt may be blocked by privacy settings
- BIt does not work with POST requests
- CIt can be easily spoofed
- DIt is not sent with HTTPS requests
10.Which of the following best describes a CSRF attack vector?
- AA SQL injection in a login form
- BA forged request sent from a different site
- CA phishing email with a malicious link
- DA malicious script injected into a webpage
11.Why is it important to use HTTPS in conjunction with CSRF tokens?
- ATo prevent token reuse
- BTo secure the transmission of tokens
- CTo encrypt CSRF tokens
- DTo authenticate users
12.Which of the following is a drawback of using CAPTCHA for CSRF prevention?
- AIt requires server-side validation
- BIt increases server load
- CIt is ineffective against bots
- DIt degrades user experience