DEV Community

hemanth.hm
hemanth.hm

Posted on

6

Explain CSRF like I'm five.

Top comments (1)

Collapse
 
mohanarpit profile image
Arpit Mohan

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

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️