Heartbleed, Running the Code - Computerphile

Поделиться
HTML-код
  • Опубликовано: 2 дек 2024

Комментарии • 385

  • @LittleVolii
    @LittleVolii 5 лет назад +115

    "lets move into the office"
    gotta show this b-roll of ducks first

  • @cypher9000
    @cypher9000 4 года назад +51

    From a programmer's perspective it's astounding that the memcpy part of code was peer reviewed and passed all the checks without anyone thinking "But what if someone sends the length that is greater than the actual payload?". Also whoever wrote that file needs to read up about variable naming. bp, lp, p, etc. Jeez.
    Great video though, thanks for uploading!

    • @patrickconrad396
      @patrickconrad396 2 года назад +4

      I'm not like a pro yet but from my experience some complex or more secure apps do have variables named like this. Idk id guess it's security over readability maybe? And I'll say it's always easier to understand a vulnerability after they happen rather than before. Seems so simple to us but who knows what they were thinking. Or maybe the complexity with the variables actually caused the issue lol

    • @mutzikatzi1
      @mutzikatzi1 2 года назад +12

      @@patrickconrad396 Security by obscurity isn't really security.
      It's probably because for people who write this kind of codes, it's kinda obvious.
      p = pointer, bp = buffer pointer, pl = payload length
      But i also don't like those short namings.

    • @joseguillermo1790
      @joseguillermo1790 2 года назад +1

      @@mutzikatzi1 Totally agree

    • @raglandasir6885
      @raglandasir6885 2 года назад +1

      Yes. We are never supposed to trust the client

  • @jochemvanl
    @jochemvanl 10 лет назад +42

    Great video. XKCD has a nice comic briefly explaining what the bug is (great for your non-tech friends), but this video goes just a little further in explaining how it works.

  • @Doc_Fartens
    @Doc_Fartens 10 лет назад +23

    Fantastic work as always. Nice clear explanation of a fairly important subject.

  • @ScottLahteine
    @ScottLahteine 10 лет назад +1

    An excellent look at Heartbleed and the nature of security bugs in-general.

  • @andersevenrud
    @andersevenrud 10 лет назад +2

    I would really love to see more code reviews here. This is great stuff!

  • @thesecondislander
    @thesecondislander 10 лет назад +211

    I'm not a programmer but i can see how coding something which essentially completely trusts the data sent by the client to fit a format without validating it is a bad idea...

    • @ZweiSpeedruns
      @ZweiSpeedruns 10 лет назад +6

      I found that to be the case in most of the web. Because of this, this is why myspace worms break out. With all websites trusting eachother, you can do SQL Injection and XSS.

    • @atheistpariah
      @atheistpariah 10 лет назад

      You are, indeed, correct. It is always best practice to check if an email field fits the pattern *@*.* or that a password field is at least 6 characters in length or, if you're accessing a database, that your table variable has greater than 0 rows. Not only does it prevent unforeseen error messages, it prevents an exploit such as this.

    • @googlepask7551
      @googlepask7551 10 лет назад +22

      I as a programmer am deeply baffled how one could make such kind of error - the level of absolute incompetence is just staggering (programmer/s + QA). It is not even hidden under layers of other code! No validation of external data in security critical code!?
      Amazing.

    • @Celrador
      @Celrador 10 лет назад +25

      You are completely right, but as a programmer I want atleast to explain, how bugs like this can occur:
      If you are writing several thousand lines of code, it is rather likely to forget the checking processes for the data at one point or the other. And it's even more likely for something like this to happen, if you are coding protocols. (As network protocols usually need to be as performance-efficient as can be and therefore you try to accomplish your goal in general with as few lines of code as possible.)

    • @compscijedi
      @compscijedi 10 лет назад +25

      This is literally the first lesson we learned in computer science classes beyond the basic "Intro to Programming" course; namely, don't trust the end-user. Assume they are either 1) a complete idiot who won't use the software correctly or 2) a malicious user who will exploit your program if possible. NEVER EVER trust data sent from a user without performing sanity checks and validating it

  • @Artifactorfiction
    @Artifactorfiction 10 лет назад +6

    Amazing how this wasn't spotted much earlier

    • @ghostandgoblins
      @ghostandgoblins 10 лет назад +7

      CelmorSmith
      I believe it was purposely put in there on the behest of government agency. Its seems like a very obvious mistake. This is first year university level logic mistake. Like a situation where the lecturer makes very elementary flaws in the code and students are given 15 min to correct it. As another poster mentioned that not being someone from a programming background even he could see the inherent logic flaw. That is, trusting data sent WITH OUT VERIFYING IT. This is utterly unheard of in any programming practice.
      So this to have escaped professionals designing security... is highly suspect to say the least. I think you have to include more people then we think in to the "bad guys" group unfortunately.
      Some of those who run forces are the same who burn crosses ~ RATM

    • @rlamacraft
      @rlamacraft 10 лет назад +3

      It has been known about for years, as with lots of bugs academics and industry experts are aware of many of these but it simply too costly or not seen as worth fixing unless there is a known or presumed risk. You must remember that the majority of the population are extremely lazy and uneducated in the ways that computers work - and really that is how security is maintained.

  • @publicsafetydan
    @publicsafetydan 10 лет назад

    Very good explanation! I have seen lots of people try to explain this, and this is by far the easiest to understand for someone unfamiliar with SSL or C

  • @valkin07
    @valkin07 10 лет назад

    One of your best videos yet Brady

  • @FahadAyaz
    @FahadAyaz 10 лет назад +1

    A good explanation of the "heartbeat bug" and why it's so dangerous. I'm surprised that it lasted in the wild so long!

  • @haarmegiddo
    @haarmegiddo 10 лет назад

    Best computerphile video to this date

  • @figloalds
    @figloalds 9 лет назад +120

    I hope nowadays C programmers have learned to create understandable names to functions and members :|

    • @jwenting
      @jwenting 9 лет назад +48

      ***** you mean lpfstrHW doesn't tell you anything? ;)

    • @murch2
      @murch2 9 лет назад +3

      Ip from string ...hardware?

    • @sk8rkid135
      @sk8rkid135 9 лет назад +7

      +Felype Rennan Nope.

    • @figloalds
      @figloalds 9 лет назад +5

      I agree that Java can't contain C code, but C# allows for unsafe native code, yes, usage of native libraries and there is C++/CLI as well.
      And naming conventions, they could name things well in the C standard libraries, like pascal guys used to do, but, they just chose to not.

    • @samstromsw
      @samstromsw 9 лет назад

      +CaptainDuckman Hungarian Notation, the idea is that you include the type of every variable in its name. It makes it more obvious if you are using the wrong type.

  • @ThomasGiles
    @ThomasGiles 10 лет назад +7

    Tom did a great job of explaining this, I feel. But I guess some people are looking for more detailed stuff. Crazy how bugs like this are still getting through...

    • @Martial-Mat
      @Martial-Mat 10 лет назад +1

      Despicable that bugs like this are getting through in the very part of the system designed to be extra secure.

  • @h3r3t1c
    @h3r3t1c 10 лет назад +2

    Great explanation of the heartbleed bug!

  • @AV1461
    @AV1461 10 лет назад +1

    Really good. Thank you.
    I'd love to see the fix - the checks they added 7:15. Or at least what type of things can be done.

    • @CelmorSmith
      @CelmorSmith 10 лет назад

      checking if the payload is the length specified by the user would suffice.
      Sth. like "if(payloadLength == payload.Length)" (but i'm not a C programmer) would be enough if the container has that method. But finding out the Length would be with that Method easier anyway.

  • @goeiecool9999
    @goeiecool9999 10 лет назад +19

    Make a video about multi-core CPU's and the benefit of 64-bit architectures. I realized that if 8-bit was enough for instruction sets back in the day. So what do we do with the 56 extra bits? Then I realized maybe it's for sending multiple instructions at once per processor core. So yeah, video's about processor architectures.

  • @coopergore2884
    @coopergore2884 8 лет назад +8

    Dr. Bagley's shirts are fly as shit.

  • @EddieSundvall
    @EddieSundvall 10 лет назад +2

    Very good reminder of how important it is to be defensive about your programming, especially in unsafe languages like C!

  • @agbook2007
    @agbook2007 10 лет назад

    Well explained, Computerphile!
    Best video of your channel! Keep them coming!

  • @habdochkeineahnung
    @habdochkeineahnung 8 лет назад +2

    i held a architectural speech about this building here in germany! :) nice to see it again this random.

  • @unfa00
    @unfa00 4 года назад +2

    Learning how Heartbleed makes the server send in random memory contents made me laugh so hard...

  • @luisgbm
    @luisgbm 10 лет назад

    Fantastic video, thanks Dr. Bagley and Computerphile!

  • @shtfgear
    @shtfgear 10 лет назад +33

    great explanation of heartbleed.

  • @DFX2KX
    @DFX2KX 10 лет назад +2

    Interesting. Nice to see why there was so much noise about this online. Part of me wants to face-palm at this, but it's really quite a simple mistake to make.

  • @yakacm
    @yakacm 8 лет назад +3

    We're not going to give you the link for the exploit, no but you did tell us about it and now all we need to do is search for it and we will find it in 0.45 seconds.

  • @sean3533
    @sean3533 10 лет назад +21

    Where was the opening filmed? Its beautiful

    • @Computerphile
      @Computerphile  10 лет назад +27

      That's the University of Nottingham Jubilee Campus, home to their Computer Science building :) >Sean

    • @sean3533
      @sean3533 10 лет назад

      ***** Thanks Brady, I'll have to check out that campus!

    • @peeedurr
      @peeedurr 9 лет назад +3

      +Sean Haggard Looks a lot like York's new place. Very similar to Nott's obviously.

  • @weemist
    @weemist 10 лет назад

    This is disturbingly easy. How could have gone unnoticed for such a long time?

  • @whiterottenrabbit
    @whiterottenrabbit 10 лет назад +22

    This reminds me thematically of the RSA bug half a year ago... What I still don't understand with the heartbleed bug, though, is why it is necessary to tell the server how long the message is. Can't it determine the length of the message on the basis of the message itself? I mean, C is used for high-precision scientific computations in applied mathematics for decades, but it can't count how many bytes a message has? ò.Ô

    • @natnew32
      @natnew32 5 лет назад +3

      Strings don't have a length parameter.

    • @masonhunter2748
      @masonhunter2748 4 года назад

      Say the next 6 letters: Badeth haha
      Would be the same as
      Say this: Badeth

    • @karlosdaniel6537
      @karlosdaniel6537 3 года назад

      @@natnew32 Yes, and string isn't even a data type in C, they're just an array of characters.

    • @williamdrum9899
      @williamdrum9899 3 года назад +5

      Short answer: No.
      Long answer: The computer has no way of telling where an arbitrary sequence ends, unless it uses some sort of terminator value or a predefined size placed in front of the sequence.

    • @cantinasongband
      @cantinasongband 2 года назад +2

      clearly there is a way to tell the actual size of the payload since it was needed to apply the patch. the entire issue was caused because the code didn't check if the actual length of the payload matches the integer value provided by the client.

  • @pij3333
    @pij3333 10 лет назад +2

    Should'nt you link to the XKCD explanation? It's ingenious.

  • @subbuktek
    @subbuktek 10 лет назад

    beautiful. Thanks. we need more videos from this gentleman

  • @KilloZapit
    @KilloZapit 10 лет назад +1

    I never even heard of this bug before. Funny thing is, I saw he bug before he described it. See, this is why I would be really reluctant to make code that messes around with memory like that in security. It's amazingly easy to mess it up when you don't have type protection. But I guess it's pretty easy to mess up even if you do sometimes.

  • @LdaHashZero
    @LdaHashZero 9 лет назад +4

    Another reason to always memset any temporary buffers in memory containing passwords/keys after you're finished using them. This includes local function variables allocated on the stack before you return.

    • @cjxordi
      @cjxordi 7 лет назад

      How many processor cycles would it take? When you would do that to every variable in your code.

  • @kevinnio
    @kevinnio 10 лет назад

    The best explication about Heart Bleed I've found. Thank you very much!

  • @LeviG
    @LeviG 10 лет назад +2

    Nice video. Great explanation.

  • @arindamsarkar4813
    @arindamsarkar4813 10 лет назад

    Thank you for not dumbing it down! :D

  • @PvtHaggard
    @PvtHaggard 10 лет назад +1

    Great explanation.. Clears it all up for me.. Thanks

  • @StrikevonNice
    @StrikevonNice 10 лет назад

    Thanks for explaining this. I looked at some of the code to test for the heart-bleed bug but not knowing the server side code meant I was unsure why this happened.
    Nice clear explanation and maybe we could have a video on networks and network protocols. By networks I mean like tor etc. and not just here is a star network and here is a bus network etc.

  • @SanyaIVLitvyak
    @SanyaIVLitvyak 10 лет назад

    Thanks, very interesting to see an explanation of the code!

  • @AntivirusRatings
    @AntivirusRatings 10 лет назад +1

    Absolutely loved your explaination.

  • @indiansoftwareengineer4899
    @indiansoftwareengineer4899 6 лет назад +1

    please provide subtitles.
    best content.

  • @nija323
    @nija323 10 лет назад

    great explanation of the the heartbleed bug

  • @frostfang83
    @frostfang83 10 лет назад +1

    Very nice look at how it works

  • @DrenImeraj
    @DrenImeraj 10 лет назад

    How did this pass testing? Giving a different payload size than the real one is something very basic, it's so weird it sounds intentional.
    AWESOME video by the way, thank you!

  • @MacShapow
    @MacShapow 10 лет назад +1

    Crazy bug! What gets me the most is how chronically underfunded OpenSSL apparently was. At least people are pitching in now. Hopefully other important open source projects won't have to go through that.

  • @TheBertjeT
    @TheBertjeT 10 лет назад +1

    Wow, I get it now! Great explanation!

  • @henrikwannheden7114
    @henrikwannheden7114 10 лет назад

    Ooooh! Very nice Ataris in the background! Cool! :D

  • @MrNobody_Music
    @MrNobody_Music 10 лет назад

    Another great video, Where can I get a link to the code that computerphile won't give us , for educational purposes of course

  • @Nestro1244
    @Nestro1244 9 месяцев назад

    Thank you for that explanation. Helped me a lot.

  • @Borednesss
    @Borednesss 10 лет назад +14

    I had no idea what this was about until 7 minutes in lol

  • @melkon2103
    @melkon2103 10 лет назад

    Great video always amazing to see the exploits being exploited in action ;)

  • @14thlordofdecay15
    @14thlordofdecay15 10 лет назад

    Brilliant as always.

  • @erikito6092
    @erikito6092 10 лет назад +1

    My father was telling me that the company he worked for knew about this bug for several years but they only fixed it now when it was discovered by hackers.

  • @TheDoucheChill
    @TheDoucheChill 10 лет назад

    That's a cool looking area! Where was this shot?

  • @dasten123
    @dasten123 10 лет назад

    great explanation, didn't expect it to be that good :)

  • @SamuraiGuevara
    @SamuraiGuevara 10 лет назад

    that was really informative and excellently explained!

  • @diceLibrarian
    @diceLibrarian 6 лет назад +2

    Give me the 500 Letters of Tom has a cat: Tom has a cat (other unrelated information)

  • @jerrylittlemars
    @jerrylittlemars 10 лет назад

    Thanks for this! I was wondering how the bug worked

  • @jirkav
    @jirkav 10 лет назад

    Thank you for explaining, very interesting stuff and great video!

  • @CaptainMarzz
    @CaptainMarzz 10 лет назад +2

    Very interesting stuff!

  • @garethdean6382
    @garethdean6382 10 лет назад

    Nothing beats XKCD's explanation.

  • @KSITREVS
    @KSITREVS 10 лет назад

    Brilliant video, I heard this on the news and wanted to find out how it actually worked

    • @AJSchultz
      @AJSchultz 10 лет назад

      I like the scene with the Ducks.

  • @hbrg9173
    @hbrg9173 Год назад

    The font is so lovely! Is it comic sans?

  • @HackingVision
    @HackingVision 8 лет назад

    Thanks Steven Bagley.

  • @spiros1994
    @spiros1994 10 лет назад

    The ASLR lack of *BSD and the weak version in Linux are also, I think, make this attack to be more successfull. If not please correct me.

    • @CyDek10
      @CyDek10 10 лет назад

      Not really - ASLR doesn't help you in this instance. Even though the OS gives you memory-pages with "random" starting adresses you still get ~4kb per page. That is, however, much more than a (typical) single variable needs, so you end up storing more than one variable per page. And this again is done sequentially, so the probability of reading actual data via this bug is pretty much the same with or without ASLR ;)

    • @Z80Fan
      @Z80Fan 10 лет назад +2

      This has nothing to do with it: Address Space Layout Randomization randomizes the loading address of the program and its dynamic libraries, so that it's very difficult (almost impossible) to write shellcode to exploit a vulnerable program.
      Hearthbleed doesn't inject shellcode; it just tricks the vulnerable client/server in sending what it has in its writeable memory.

    • @calrogman
      @calrogman 10 лет назад +1

      OpenBSD was actually the first mainstream operating system to integrate ASLR and activate it on by default. libc support for ASLR doesn't help with this bug because of OpenSSL's use of an internal malloc.

  • @kbo206
    @kbo206 10 лет назад

    Great video although I'm still trying to figure out the purpose of the printed code. Just something to give a visual?

  • @porkypine1888
    @porkypine1888 10 лет назад

    was waiting for this!!!

  • @OmegaCraftable
    @OmegaCraftable 10 лет назад +30

    Thanks for the info :)

  • @jaredmulconry
    @jaredmulconry 10 лет назад +2

    I'm a programmer. I know that programmers make mistakes, it's pretty much unavoidable. A mistake like this is so incredibly easy to make, and when you're working on a piece of code that a percentage of the world's servers will be relying on to keep data secure, the cost of those mistakes are extreme. I pity the programmer(s) who made this mistake.

    • @eTheBlack
      @eTheBlack 10 лет назад

      It is OpenSSL

    • @CelmorSmith
      @CelmorSmith 10 лет назад +1

      Honestly, I don't, and i don't trust OpenSSL anymore if only one programmer wrote and checked the codes behavior with the outcome of 2 scenarios that of the right user input and that with the wrong user input.

  • @first.engineersecond.scien7663
    @first.engineersecond.scien7663 9 лет назад

    not a programmer but, that block of code bout unchecked payload seems easy to understand for a programmer. the exploit was there for long time?

  • @okaythen001
    @okaythen001 10 лет назад

    if this heartbleed never happened, do you guys change your password every once awhile? like half year or so, most of the people I know they don't change their passowrd, is it necessary to change it once awhile?

  • @nO_d3N1AL
    @nO_d3N1AL 10 лет назад

    Great explanation!

  • @Roxor128
    @Roxor128 10 лет назад

    Nice! Seeing the bug in action makes the news story way more interesting. TV stations, take note of this!

  • @mcvoid1
    @mcvoid1 10 лет назад +16

    The bracket style is making me twitch. Let the holy war commence.

  • @PsiMX
    @PsiMX 10 лет назад +1

    Why didn't the memcpy cause a segmentation fault when asked for more memory than the variable held? I suppose OpenSSL has to be running their own memory manager that allowed for this segmentation violation.

    • @DDranks
      @DDranks 10 лет назад +1

      Segmentation fault happens when a process tries to access memory that doesn't belong to its accessible memory area, or "segment". The operating system catches this kind of errors because it keeps account which area belongs to which process. However, it doesn't or even couldn't in principle "micromanage" whether the accessed memory belongs to a certain _variable_ or not.

    • @PsiMX
      @PsiMX 10 лет назад

      Sorry for the ambiguity. I meant to say, "Why didn't the memcpy EVER cause a segmentation fault when asked for more memory than the variable held?" It seems that the bug would have been caught much earlier if segfaults occurred during malicious actions.
      With the default malloc, the variable would eventually be randomly assigned near a border between two segments and the OS would throw the segfault.
      I'm thinking they had a custom malloc implementation that placed the variable in front of a big chunk of data managed by that custom memory allocator.

    • @DDranks
      @DDranks 10 лет назад

      But Psi Mayfield has a valid point, now that I think it. After all, segfaults should happen even when reading from an "unallowed" location - and it certainly could try to read from such a location, I think?

    • @julietmikealpha
      @julietmikealpha 10 лет назад

      Psi Mayfield memcpy is reading valid memory, it's just uninitialised. A buffer has been allocated based on the length from the client, it's just the client didn't send enough to fill that buffer (client says, "Imma gonna send 64k" - server allocates 64k - client sends 32k - rest of the receive buffer is uninitialised, but valid). That's the bug :)

  • @onwul
    @onwul 10 лет назад +1

    It is a really careless programming. Avoiding such mistake is very easy if you read the manual.
    Socket function recv, which is used to read data, takes in the number of bytes you want to receive/read, and returns the number of bytes it received. You tell how much data want, you then use returned value to find out how much data you've actually got.

  • @CountlessColumns
    @CountlessColumns 10 лет назад

    Yesterday I said "I wish computerphile would make a heartbleed video." I didn't think it would happen though!

    • @malcolmforde4969
      @malcolmforde4969 10 лет назад

      Tom Scott also did a great one on his own channel.

  • @sshort21
    @sshort21 10 лет назад

    Nice explanation. Well done.

  • @PontusWelin
    @PontusWelin 10 лет назад +1

    Very informative! Thanks!

  • @slr150
    @slr150 10 лет назад

    The problem is that languages like C with pointer arithmetic allows procedures shoot past array boundaries and read into other parts of the heap.

  • @michaelgeorgoulopoulos8678
    @michaelgeorgoulopoulos8678 10 лет назад

    Kudos for the Atari ST sitting in the background!

  • @Anamnesia
    @Anamnesia 10 лет назад

    XKCD 1354: explains it REALLY simply...

  • @DFPercush
    @DFPercush 10 лет назад

    Does this never cause an access violation in the OpenSSL process? I would think eventually it would run out of bounds and crash the server.

  • @jorl17
    @jorl17 10 лет назад +1

    Brady, could you please keep the camera showing code when it's being discussed? or at not make sudden cuts so often. It breaks focus. Other than that, wonderful video!

  • @TheThunderSpirit
    @TheThunderSpirit 8 лет назад

    accessing other rams over Internet is awesome

  • @Harm10412
    @Harm10412 10 лет назад

    But if you are trying to read beyond your memory, shouldn't the program sigsegfault occasionally?

  • @GeekIWG
    @GeekIWG 10 лет назад +1

    Wow. I am quite surprised that whoever wrote that piece of code forgot the length checks to begin with. Seems like something pretty obvious to me anyways.

  • @inafusabi
    @inafusabi 10 лет назад

    Comprehensive, this explanation. Thank you

  • @AbdelhadiE
    @AbdelhadiE 10 лет назад +6

    how did I end up watching this ..... I have no Idea what he was talkin about lol

  • @j.lo.5784
    @j.lo.5784 10 лет назад

    Isn't it possible to override the sensitive memory after usage by default? Obviously you will never know if someone reads the systems memory later.

  • @OldFilmCameras
    @OldFilmCameras 10 лет назад

    what was that editor you were using earlier on your mac?

  • @EnigmaV8
    @EnigmaV8 10 лет назад +11

    "Heartbleed" sounds like a great title for an anime series.

  • @spoonikle
    @spoonikle 10 лет назад

    gezz what took you guys so long.

  • @MrZmogZ
    @MrZmogZ 10 лет назад

    Thanks so much for some actual journalism. Everyone else in the media are like "ermahgerd enternet ermergherdon".

  • @zgintasz
    @zgintasz 9 лет назад +3

    why can't server just count the length itself?

    • @hiddenbladezzz
      @hiddenbladezzz 9 лет назад +1

      +zgintasz
      because the server needs to know when to cut the connection when all data is sent if packets are fragmented. Or when it is not completely sent, tell the client to reset the connection.
      Also if the server doesn't know how much of the packet is padding if it doesn't know the length of the actual data which means useless padding might be treated as actual data.

    • @zgintasz
      @zgintasz 9 лет назад

      isn't this functionality already implemented in udp/tcp? I mean server/client can't get half of a packet from each other.

  • @mumiemonstret
    @mumiemonstret 4 года назад

    I assume that the payload is there to let the requester validate the integrity of the reply, but what is the purpose of the padding?

  • @Friek555
    @Friek555 10 лет назад

    Why do you need the padding? Aren't that 16 bytes that slow down the protocol and cause cost (processing and network) uselessly every single heartbeat?

  • @gbrls_yt
    @gbrls_yt 6 лет назад

    nice colorscheme, which one is that?

  • @TomAlderman1978
    @TomAlderman1978 10 лет назад

    Great explanation. Thanks

  • @salat
    @salat 10 лет назад +1

    Missing the point that OPENSSL_malloc makes the problem even bigger (almost every time sensitive data, less chance to detect the illegal read from the OS, etc.)