We may earn an affiliate commission when you visit our partners.

Cross-site Request Forgery (CSRF)

Save
May 11, 2024 Updated July 12, 2025 12 minute read

Cross-site Request Forgery (CSRF) is a type of attack that tricks a user into submitting a request to a web application that they are authenticated to, without their knowledge or consent. This can be done by sending the user a specially crafted link or by embedding a script into a website that they visit.

How CSRF Works

CSRF attacks work by exploiting the way that web browsers handle cookies. When a user is logged into a website, their browser sends a cookie with every request to that website. This cookie contains a unique identifier that allows the website to identify the user and track their session. If an attacker can trick a user into clicking on a specially crafted link or visiting a website that embeds a script, they can send a request to the web application that is authenticated with the user's cookie. This request can be used to perform any action that the user is authorized to perform, such as changing their password or making a purchase.

Preventing CSRF Attacks

There are a number of ways to prevent CSRF attacks, including:

Path to Cross-site Request Forgery (CSRF)

Take the first step.
We've curated nine courses to help you on your path to Cross-site Request Forgery (CSRF). Use these to develop your skills, build background knowledge, and put what you learn to practice.
Sorted from most relevant to least relevant:

Share

Help others find this page about Cross-site Request Forgery (CSRF): by sharing it with your friends and followers:

Reading list

We've selected six books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Cross-site Request Forgery (CSRF).
Covers a wide range of web application security topics, including CSRF attacks. It valuable resource for anyone who wants to learn more about web application security and how to protect their applications from attack.
Provides a comprehensive overview of web application security. It includes a chapter on CSRF attacks that provides detailed information on how to prevent CSRF vulnerabilities in web applications.
Covers a wide range of web application security topics, including CSRF attacks. It valuable resource for anyone who wants to learn more about web application security and how to protect their applications from attack.
Provides a practical guide to penetration testing. It includes a chapter on CSRF attacks that provides detailed instructions on how to test for and prevent CSRF vulnerabilities.
Provides a comprehensive overview of security in ASP.NET Core. It includes a chapter on CSRF attacks that provides detailed information on how to prevent CSRF vulnerabilities in ASP.NET Core applications.
Provides a beginner-friendly introduction to web application security. It includes a chapter on CSRF attacks that provides basic information on how to prevent CSRF vulnerabilities.
Table of Contents
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser