Skip to content

Instantly share code, notes, and snippets.

@drumnickydrum
Created December 30, 2022 22:03
Show Gist options
  • Save drumnickydrum/c1fe7ee98999e03f2f6a8fd1d308420b to your computer and use it in GitHub Desktop.
Save drumnickydrum/c1fe7ee98999e03f2f6a8fd1d308420b to your computer and use it in GitHub Desktop.
[Security: CSRF] Cross Site Request Forgery #csrf #security
https://www.youtube.com/watch?v=eWEgUcHPle0
___
https://dev.to/hemanth/explain-csrf-like-im-five
CSRF (Cross Site Request Forgery) is also known as Sea-Surf or Session Riding. It's is a form of trick that bad folks play on the browser in order to get it to do unexpected things in applications that you're already logged in.
For example, imagine you were logged into your Supercell game on the internet. You get an e-mail saying "Click here to get 500 gems for free!". Clicking on the text, on the contrary, will actually initiate a request to Supercell to transfer all your gems to the hacker's account. Now, along with the request, the browser always sends the cookies to Supercell as well. Supercell verifies if the cookies are valid (which they are because you just logged in!), Supercell will trust the browser and the request and doesn't know that this is not what you wanted. They will go ahead and execute this instruction thinking this is what you wanted to do.
This is a CSRF. The browser & Supercell got tricked into doing something they shouldn't have done. There are multiple ways to prevent yourself and your website from a CSRF attack but that's a conversation for when you're 10. For now, stay away from spammy links. :D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment