CSRF

What is CSRF

Cross-Site Request Forgery (CSRF) is a type of web attack that exploits the trust between a website and its users. It occurs when an attacker tricks a user's browser into making an unintended and unauthorized request to a target website on which the user is authenticated.

Here's how it works:

  • The user visits a malicious website or clicks on a malicious link that the attacker has crafted.

  • The malicious website contains code that automatically sends a request to a legitimate website where the user is authenticated, without the user's knowledge.

  • Since the user is already logged in to the legitimate website, the browser automatically includes the necessary authentication credentials in the request.

  • The legitimate website receives the request, assumes it's legitimate due to the included authentication credentials, and performs the requested action, such as changing the user's password, making a purchase, or deleting an account.

The key point to understand is that the attack relies on the user's browser sending authenticated requests to the target website, unbeknownst to the user. The attacker can't directly access the user's credentials but rather exploits the trust between the user's browser and the targeted website.

Resources

Last updated