Cross Site Request Forgery - Computerphile

  Рет қаралды 764,598

Computerphile

Computerphile

Күн бұрын

Пікірлер: 350
@Sam_596
@Sam_596 6 жыл бұрын
"But since then, it's got a bit more complicated" -Tom Scott, 2013, describing the internet and the history of the universe in one sentence.
@VictorFrost
@VictorFrost 10 жыл бұрын
I love how passionate Tom is about this. You can really see it in his face and hear it in his voice.
@ionlymadethistoleavecoment1723
@ionlymadethistoleavecoment1723 8 жыл бұрын
As someone who is a complete novice, and is trying to learn about how to make websites, Tom Scott has made me terribly afraid of screwing something up and having a massive security hole.
@olatrials
@olatrials 9 жыл бұрын
The funniest thing about your videos is when you talk as if you were the server, interpreter, code or whatever! It would be funny as hell if that was the case, imagine trying to do something malicious, and having the server respond "Well, that's wrong. I'm not having that." in Tom's voice!
@matts.1352
@matts.1352 10 жыл бұрын
I remember 6 years ago (I was 12), I'd mess around with chat rooms for fun. Of course, doing so itself was stupid, but it taught me about modifying post-actions and functions, and also about proper security in how users interact with websites. Basically, I had a plugin that let me edit post data before it was sent to the site. I'd mess around with the chat a few times, see what values changed in the post data, and then figured out what separate parts and values in the data were for. Eventually, I figured out how to modify the sessionID to be the same as other users, so that I didn't have to be in the chat to play around with it. I also learned how to mess with chat servers screen-name authentication, and to modify my screen-name when I was in the chat. Worst-yet, I learned how to modify user-permissions and mess around with the admin-panel login page so that the chat server thought I was an authentic admin that logged in through the admin-panel and let me use admin operations. Of course, at the time I used it for immature things, but I eventually started thinking of ways for how the website could have avoided those problems. That sort of thinking helped inspire me to think in-depth about security in my programming projects.
@andersevenrud
@andersevenrud 10 жыл бұрын
Being a web-developer I highly enjoy this series. Tom really knows what he is talking about, and I just love the enthusiasm.
@suit1337
@suit1337 10 жыл бұрын
it disturbs me, that you're a web-developer and enjoy this :) you should already know all these issues
@andersevenrud
@andersevenrud 10 жыл бұрын
suit1337 Yes, I know about these issues. I think most of the developers out there enjoy these videos regardless of what they know about the subject. And there is always a chance of learning something new.
@nryle
@nryle 10 жыл бұрын
suit1337 You do know that web developers can be new to web development right? We don't live in the age where the only way to learn something is through a proper school. You could easily start your web development very small time on your own and be unaware of the basic security flaws...
@suit1337
@suit1337 10 жыл бұрын
I'm aware of that - and that is a shocking development in this business. Take another work field for example: someone could not easily start a business as an electrician without proper education - but you can start as a web developer. there are lots of fools around here with no clue, even in the basic properties of the business but they make shitloads of money with their crap that really fills me, doing proper work, with anger --- just an example from my country (austria) - the website of our ex financial minister was priced at 220.000 Euro the website of the agricultural ministry cost about 5,5 Million Euros and those websites are not even closely done properly and get defaced over and over again - instead of blaming the stupid overpriced web developers with no proper education they blame the "bad hackers" a few weeks ago our interior ministry presented a new 100 % hackerproof "student licence" - it was hacked only 3 days after via a very simple SQL injection i hope you understand, that it disturbs me, that every moron with no education can start a new 1 man web agency and start coding with no education in the field at all.
@nryle
@nryle 10 жыл бұрын
suit1337 I understand this, it's true of anyone who takes pride in their work. It's not really that shocking though. This is true of any business until government steps in to regulate it. I think the true problem lies in the fact that Web Development is an all encompassing term even though it has several aspects: Design, Functionality, Reliability, Marketability, and, of course, Security. From what I've seen most people think these are the same, though many have started to separate design.
@steam2300
@steam2300 10 жыл бұрын
These are some of my favorite vids on computerphile! Security issues affect everyone and we need more clear explanations. I'd love for Tom to tackle jailbreaking.
@isaac10231
@isaac10231 10 жыл бұрын
It's good having an episode of computerphile, mainly because the intricate and important details in computer are _so complicated_ even though I (thought) that I knew about computers. This kinda gives me a foundation. Also you should probably talk about logic gates, whether it's minecraft or whatnot, they explain how you could have to light switches for one light
@MegaChickenfish
@MegaChickenfish 6 жыл бұрын
Learning about this sort of thing really helps me understand *why* we covered all that stuff in Security class. At first glance it's like "oh jeez, look at all these layers upon layers of authentication, authorization, validation, validation-of-the-validation..." but these sorts of clever attacks are why. I didn't even know this sort of thing was possible.
@tedspens
@tedspens 8 жыл бұрын
I always wondered how Wordpress' nonce hash works. Thanks for the enlightenment!
@Blue.Diesel
@Blue.Diesel 8 жыл бұрын
Can't i just load the other form in an invisible Iframe and then parse and search through the html retrieved? Use the token info and create my own form.
@ragir
@ragir 10 жыл бұрын
Great, now i've got to rewrite the project i'm working on. I didn't know about this and it's so obvious. Good video!
@Airblader
@Airblader 10 жыл бұрын
If you have to rewrite a project to protect against CSRF attacks you are doing other things wrong as well
@IceMetalPunk
@IceMetalPunk 10 жыл бұрын
Rewrite? That sounds a bit like overkill. Just add a nonce token and you're as good as you'll get.
@otanix
@otanix 7 жыл бұрын
I've been looking for a video that I can send to my non-techie friends to give them slight idea about XSRF. This video is what I've seen so far that's lay-man friendly.
@TheBreadCatt
@TheBreadCatt 10 жыл бұрын
Great and informative video as always. Loving the amount of Tom on this channel.
@Enriath
@Enriath 9 жыл бұрын
Ohhhhhh, so that's what the nonce thing is. Thanks Tom!
@MaxGuides
@MaxGuides 10 жыл бұрын
you request the token with your script and later in the script you use that token easy if the form is standardized-like deleting enemy facebook pages
@coolsebz
@coolsebz 10 жыл бұрын
This is great! :D I love the way Tom explains advanced terms in really simple ideas
@Imrooniel
@Imrooniel 10 жыл бұрын
This mini series on security is just wonderfull. Love the content, love the voice, it's just great.
@CrystalblueMage
@CrystalblueMage 10 жыл бұрын
Being able to create your own version of a form a send that is a problem in general, as you could also strip out any checks in the original form you don't like.
@Betacak3
@Betacak3 10 жыл бұрын
Speaking of account deletion, it's even safer to create a token and *not* return it directly to the user, but send an e-mail containing a link with this token.
@Fuogger
@Fuogger 10 жыл бұрын
Can you explain this more? I think I get what you're getting at but please explain.
@Betacak3
@Betacak3 10 жыл бұрын
Fuogger You may know this from several websites, when you have to click a link inside of an e-mail to confirm your action.
@eldizo_
@eldizo_ 10 жыл бұрын
Will Tom be a regular? His bits are great.
@AceCorban
@AceCorban 10 жыл бұрын
I get the concept of the token, but how does the server know if a token is valid once it gets the request? Since the web is stateless, it creates the form with a random token, then sends it on its way. So how does the server know if a token it gets back is valid? Store valid tokens in memory or a database?
@DevonBernard
@DevonBernard 10 жыл бұрын
Another great video guys, looking forward to more cool explanations. Keep up the awesome work!
@philipmylan654
@philipmylan654 10 жыл бұрын
I love this guy.
@yinge101
@yinge101 10 жыл бұрын
Couldn't you get around the one-time key thing by creating a hidden/tiny/offscreen (i)frame for the ‘transfer money’ form on the bank website, and then use JavaScript to automatically submit the form?
@ChrizzyWhite
@ChrizzyWhite 10 жыл бұрын
been waiting for this video
@techtutorish
@techtutorish 10 жыл бұрын
Interesting as always!
@aerouk
@aerouk 10 жыл бұрын
This guy's videos are brilliant! Web security and hacking is so interesting. :)
@jayjaxx2557
@jayjaxx2557 8 жыл бұрын
Hmm at 3:22 you can quite clearly see "my awesome blog" before tom has drawn it. oops
@mkaatr
@mkaatr 10 жыл бұрын
Thanks for the video. This is really useful.
@GenericRubbishName
@GenericRubbishName 10 жыл бұрын
More from this guy!
@Stonerman023
@Stonerman023 10 жыл бұрын
There are my favorite *philes.
@MPG1410
@MPG1410 10 жыл бұрын
This guy is awesome
@deathZor42
@deathZor42 10 жыл бұрын
bit skeptical about the advice because i see a lot of php developers trow in a non-cryptographically secure random number and hoping it will work, and the reality is well it takes more time it can still be done as most of the random number generators within php are not random ( they are predictable )
@elpiel
@elpiel 10 жыл бұрын
Actually even with Token, we can get it simply when the user enter the site, we go Threw our code to the page and get the token that is now :) Or even better: On clicking -> GO get Token -> submit the permanent link =)
@Akshaylive
@Akshaylive 10 жыл бұрын
There are headers to block XSR if I'm not mistaken
@jakeceder
@jakeceder 10 жыл бұрын
Where IS the brown paper?
@evildude109
@evildude109 10 жыл бұрын
Is this something I can see in context, like in the html of this web page? Where would it be in the code? I don't quite understand it yet.
@RONNIE5579
@RONNIE5579 10 жыл бұрын
Telling people about how clicking anywhere on the internet could potentially cause mayhem, on a youtube video xD After watching this I wonder how many people thought deeply about posting a comment :L
@jdgrahamo
@jdgrahamo 10 жыл бұрын
Very helpful, thank you.
@TessaBain
@TessaBain 10 жыл бұрын
Wonder if the games I play use it in their deletion form? _goes off to make a post in the staff forum to bring it to their attention just in case_
10 жыл бұрын
What happens if we make a call to the page that generates the form and take the token from there?
@submissivepeanutbutter4030
@submissivepeanutbutter4030 5 жыл бұрын
More awesome blogs
@gwenynorisu6883
@gwenynorisu6883 6 жыл бұрын
Interesting. This explains an awful lot of the things yer typical online banking service does and the hoops it makes you jump through to just to get access, let alone authorise any kind of activity...
@troyf1
@troyf1 9 жыл бұрын
Hummm... are those bars on the back window?
@rileypatterson7512
@rileypatterson7512 2 жыл бұрын
Man I do not know how I got this career but this is where I am so I have to learn this shit. Don’t get me wrong it’s really interesting it’s just really hard for me to learn this stuff.
@kaitlyn__L
@kaitlyn__L 10 жыл бұрын
would modern browsers' tab sandboxing prevent that sort of thing?
@ja-vishaara
@ja-vishaara 9 жыл бұрын
Tom, I'm never going to your blog, that's for sure now.
@o2dyt
@o2dyt 10 жыл бұрын
"My hand has lower ambitions than my brain does" Yeaaah I know the feel...
@MozQit0
@MozQit0 10 жыл бұрын
After just graduating with a Bachelor of Computer Science, I can safely say I would have loved to have this guy as a lecturer; he explains things simply, clearly, interestingly and correctly! I'd like to say a big thanks to the Tom and the Computerphile team for spending their time and effort to make these great videos!
@craftxbox
@craftxbox 7 жыл бұрын
where's the brown paper?
@АндрейБеньковский-ш5к
@АндрейБеньковский-ш5к 8 жыл бұрын
This video inspired me to try to "steal" my CSRF token (as if I was trying to hack my own account). I the process I reinvented cross-origin HTTP requests and clickjacking. Turns out both this attacks are well-known and defended against.
@luiscanamarvega
@luiscanamarvega 9 жыл бұрын
Please, don't ever stop making these.
@TheWP120
@TheWP120 8 жыл бұрын
These Tom Scott videos are so addictive, I can't stop watching! xD
@kiddor3
@kiddor3 10 жыл бұрын
Ironically I saw "nonce" today in a code and I thought someone didn't follow code standard for nOnce or n_once. Now I know what they meant.
@123456789robbie
@123456789robbie 10 жыл бұрын
Tom Scott is quickly becoming one of my favourite people on the internet. He's the kind of person i'd have wanted to be best friends with if we'd been kids at the same time and place
@user-wv8kr3yn6l
@user-wv8kr3yn6l 9 жыл бұрын
@harrydevokone9505
@harrydevokone9505 9 жыл бұрын
Simon S Dude...
@nowhereman3814
@nowhereman3814 8 жыл бұрын
So...what the hell does nonce mean in Britain?
@MisterPorkchops
@MisterPorkchops 10 жыл бұрын
Tom is probably my favorite person on this channel. I just love the way he talks and I love the topics he has.
@thoughtsofadyingatheist1003
@thoughtsofadyingatheist1003 Жыл бұрын
You'd be surprised how many web devs don't know about this in 2023
@ramikafa
@ramikafa 10 жыл бұрын
This guy is an excellent presenter. Please, more of him.
@magnetar02p.23
@magnetar02p.23 7 жыл бұрын
I know this is not relevant to this video, but can you do a video on elliptic curve RSA cryptography?
@kuro68000
@kuro68000 9 жыл бұрын
Why does the camera randomly zoom in some times? it's really distracting.
@florianmuellerCH
@florianmuellerCH 10 жыл бұрын
Damn. Your /delete?confirm=true statement was a 100% hit. Gotta rename my parameters ;D
@vinkuu
@vinkuu 10 жыл бұрын
Here's one consideration on how important it is to validate user input on the server side. Take any disabled html element. Open up firebug console and run some javascript, eg. using jQuery syntax: $('input').removeAttr('disabled'); $('input').removeAttr('readonly');. Then happily make any changes to the input elements and submit the changes.
@samramdebest
@samramdebest 10 жыл бұрын
but what if the malicious webpage itself loads the bank site in the background, it can get the token that way.
@mart3323
@mart3323 10 жыл бұрын
cross-site scripting is blocked in browsers as a simple example, say i have a site with a bunch of livestream embeds, and i set up a script that when i press F2, it scrolls to my favourite one As soon as i click inside any of the streams, say the play button.., F2 won't work and it'll continue to not work until i click outside again, giving focus back to my own page The only way they can load the bank would be to actually load the bank visibly to you, because you're the only one that can interact with it.. the scripts can't..., not theirs anyway
@samramdebest
@samramdebest 10 жыл бұрын
I think that what you are saying is incorrect, i have done some coding with AJAX(Asynchronous JavaScript and XML) and it didn't need to be visible to be able to load. and almost every page on the internet gets data from other sites invisible(i once had a chrome extension that showed which site you visited and where they took data from, an average site connected to more than 20 different websites(like for tracking: google analytic)
@OKMX5
@OKMX5 10 жыл бұрын
I think that the token will be different because it is another loading/creation of the form.
@samramdebest
@samramdebest 10 жыл бұрын
what do you mean other loading/creation of the form, it is not, the site downloads the form and the token, and then sends it back to the bank
@samramdebest
@samramdebest 10 жыл бұрын
oh do you mean, that even for the request of the forum not only the submission needs to be accompany by the token? That would make more sense and would solve that problem, thanks
@won1853
@won1853 10 жыл бұрын
Wow surprised to see no comments when I finished watching this. But of course there are 61 comments when I refresh the page :)
@flidrl
@flidrl 10 жыл бұрын
Ya know, if accepting request from other website would work, then the form would likely be accessible by javascript running from the other website as well. Which means, my javascript could request the form, look for that random string of characters (fairly easily too) and add it to its spoofed request, meaning we would be back to square one.
@k776
@k776 10 жыл бұрын
The easiest way to get around most of these: Use a solid framework which helps prevent all these attack types. Take Ruby on Rails for example. While not perfect, the latest version is pretty good at avoiding SQL injection, XSS, and CSRF, along with other built in things, like secure cookies, and proper storage of passwords... with a framework doing most of the basic stuff, it's up to the developer not to do anything stupid.
@nosscire
@nosscire 10 жыл бұрын
Holy crap! While I have enjoyed these videos since the start of computerphile, this is the first time I directly learned, or more rightly, realized something. I do have webpages that are badly coded like this. Time to go off and fix!
@lloydnone
@lloydnone 10 жыл бұрын
Oh wow. It's funny seeing people writing about how they implemented a 'nonse'. If only they they knew. This was a great video! Tom is always so enthusiastic, it's great! One request would be making the felt tipped pen sound quieter/non existent. It makes my toes curl!
@FernieCanto
@FernieCanto 10 жыл бұрын
Word! That is even worse in Numberphile.
@Sc2mapper117
@Sc2mapper117 9 жыл бұрын
This was really interesting. I was aware of cross-site-scripting and sql Injection but I had never heard of this. Thanks :)
@edinatl2008
@edinatl2008 9 жыл бұрын
Thanks for helping me learn the valuable lesson of what a 'nonce' is in UK.
@blob1190
@blob1190 7 жыл бұрын
Got an exam on this tomorrow, this was so helpful for me, thanks! The way you explain things makes them easily accessible
@juandig
@juandig 7 ай бұрын
this still goes under the radar 10y later btw
@Marphale
@Marphale 6 жыл бұрын
I don't understand this and must be missing something. What's to stop the malicious site from sending a GET request for the form and then (via javascript) sending the POST request with the token afterwards? If the answer is that the GET request is secured by the encrypted session ID for the user, then why does that encrypted session ID not secure the POST request also?
@TechMetalPenguin
@TechMetalPenguin 10 жыл бұрын
And here's the third one... Tom great as always. By the way, with Django framework the way to prevent it is as simple and comfortable as adding {% csrf_token %} inside the form tag =).
@weckar
@weckar 6 жыл бұрын
Of course, any real page doing this wouldn't try one bank; it'd try 20.
@EddyProca
@EddyProca 10 жыл бұрын
If you like this guy (of course you do), check out his channel ***** he has some great videos on linguistics.
@mw2isepic1
@mw2isepic1 10 жыл бұрын
This is indeed a big security hole. I did not know what CSRF did before so I couldn't apply a patch to my site. I can now though. Thanks Tom/Numberphile. Nicely explained :)
@krajek1985
@krajek1985 9 жыл бұрын
Tom, You are the best. Keep making those excellent videos.
@Niosus
@Niosus 10 жыл бұрын
It's also a good idea to add the action to the seed which generates the nonce, so the nonce to post a comment is different from the one which allows you to delete your account. If you combine that with the username and set a short timeout the users needs to have been on the form which does the action, somehow you need to be able to steal that nonce and get them to go to your infected page. It's basically no longer a security issue in that case. When someone loads a form they usually intend to fill it out and you could even track when they leave the form to immediately invalidate the nonce.
@Linksbruder
@Linksbruder 10 жыл бұрын
Just wanting to let you guys not know that you are doing a great job I love watching your videos and always get excited when I see that you posted another one. I'm 16 years old and enjoy programming but thoose videos add another point of view to it and really get you thinking Greetings from Germany
@tyroneslothdrop9155
@tyroneslothdrop9155 10 жыл бұрын
So, the money being transferred to the hacker's account, where is it coming from? If I posted a comment on the malicious blog, the money wouldn't be coming from my account. The fine details don't really make sense here. Would this attack effect me at all?
@FFVison
@FFVison 10 жыл бұрын
I have heard about this before, but there's a simple way around it. The problem with it is that the same malicious form on the unrelated blog can still submit a page request on the target site and grab the token before submitting to the page that actually does the damage. All it takes is a little bit of PHP knowledge, some knowledge of HTTP request headers, and a little ingenuity. Still, it's good to know how and why to do this.
@user-uc9fm8bn9o
@user-uc9fm8bn9o 10 жыл бұрын
Ooooh, maybe that's how people can hack or change your status on Facebook. Except for the times where it's someone physically doing it because the person was an idiot and left themselves logged into Facebook on their friend's computer.
@Kerbobotat
@Kerbobotat 10 жыл бұрын
Really interesting! But how do you know if your bank, etc. is using the token system? Also, can we get a computerphile video explaining bitcoin?
@TheSam1902
@TheSam1902 8 жыл бұрын
Nice video ! I already heard about it but I didn't understood everything, so you've made the web a safer place !
@Amdrel
@Amdrel 10 жыл бұрын
I just learned about nonces yesterday and implemented one ;)
@WyandWombat
@WyandWombat 9 жыл бұрын
I'll simply stay away from awesome-blog, problems solved.
@grp215
@grp215 10 жыл бұрын
What was the name of that one-time-key and why do the British have a different name for it?
@grp215
@grp215 10 жыл бұрын
Thanks!
@allcoleldlwowlflfolfkskw
@allcoleldlwowlflfolfkskw 10 жыл бұрын
Alex Simpson ..and further, the reason it's called a "nonce" in computer terms is because it's short for number-used-once.
@hecanylmz
@hecanylmz 4 ай бұрын
I've just watched the video, it was really helpful on my course! Thanks! 🙂
@austino5069
@austino5069 10 жыл бұрын
use Rails for Out of the box, auto-configured CSRF protection. That's ruby.
@Corrup7ioN
@Corrup7ioN 10 жыл бұрын
As well as using a sex offender, if you are doing anything remotely serious such as a money transfer or deleting an account, it doesn't hurt to either ask the user to confirm their password or send a confirmation email with a 1 time token
@Zimpfnis
@Zimpfnis 10 жыл бұрын
I know little about IT or programming, but your videos are always very informative and easy to understand, so thanks!
@Mrjesse451
@Mrjesse451 10 жыл бұрын
How is a random user supposed to know if a site they are using is using this token during requests?
@cookman169
@cookman169 10 жыл бұрын
Go look in source code if there is a where 1337 would be the random number.
@IceMetalPunk
@IceMetalPunk 10 жыл бұрын
In general, you can view the page's source (Right Click->View Page Source on most browsers) and look for the form (search for
@TechyBen
@TechyBen 10 жыл бұрын
"A bit more complicated". My new catch phrase. :)
@breakingVIE
@breakingVIE 10 жыл бұрын
during the whole vid I had to think of the cookie monster ^^
@svnhddbst8968
@svnhddbst8968 9 жыл бұрын
i feel tom should put a thing on his blog that makes your accounts user image change to a silly thing, possibly supporting internet security.
@pelatho
@pelatho 9 жыл бұрын
What if the malicious site makes a request to the bank's website through an invisible ? Wouldn't the contain the token? And you could then read the token and make your POST request.
@pelatho
@pelatho 9 жыл бұрын
Wait... the malicious site cannot read any contents of the if it loads data from another domain! Same-origin policy!
Cracking Websites with Cross Site Scripting - Computerphile
8:34
Computerphile
Рет қаралды 1,5 МЛН
The Problem with Time & Timezones - Computerphile
10:13
Computerphile
Рет қаралды 4 МЛН
小天使和小丑太会演了!#小丑#天使#家庭#搞笑
00:25
家庭搞笑日记
Рет қаралды 17 МЛН
Incredible: Teacher builds airplane to teach kids behavior! #shorts
00:32
Fabiosa Stories
Рет қаралды 11 МЛН
Cross-Site Request Forgery (CSRF) | Complete Guide
48:11
Rana Khalil
Рет қаралды 94 М.
The Worst Typo I Ever Made
11:25
Tom Scott
Рет қаралды 6 МЛН
Wana Decrypt0r (Wanacry Ransomware) - Computerphile
15:19
Computerphile
Рет қаралды 1,5 МЛН
How NOT to Store Passwords! - Computerphile
9:24
Computerphile
Рет қаралды 2,3 МЛН
Cross-Site Request Forgery (CSRF) Explained
14:11
PwnFunction
Рет қаралды 451 М.
Cookie Stealing - Computerphile
16:12
Computerphile
Рет қаралды 1,1 МЛН
Your App Is NOT Secure If You Don’t Use CSRF Tokens
9:57
Web Dev Simplified
Рет қаралды 130 М.
Harder Drive: Hard drives we didn't want or need
36:47
suckerpinch
Рет қаралды 1,7 МЛН
The Attack That Could Disrupt The Whole Internet - Computerphile
9:50
Computerphile
Рет қаралды 1,5 МЛН