r/programming • • Apr 09 '14
Theo de Raadt: "OpenSSL has exploit mitigation countermeasures to make sure it's exploitable"
[deleted] — view deleted post
2.0k
Upvotes
r/programming • • Apr 09 '14
[deleted] — view deleted post
941
u/AReallyGoodName Apr 09 '14
Fucking hell. The things that had to come together to make this do what it does and stay hidden for so long blows my mind.
A custom allocator that is written in a way so that it won't crash or show any unusual behavior when allocation bounds are overrun even after many requests.
A custom allocator that favours re-using recently used areas of memory. Which as we've seen, tends to lead it to it expose recently decoded https requests.
Avoidance of third party memory testing measures that test against such flaws under the guise of speed on some platforms.
A Heartbeat feature that actually responds to users that haven't got any sort of authorization.
A Heartbeat feature that has no logging mechanism at all.
A Heartbeat feature that isn't part of the TLS standard and isn't implemented by any other project.
A Heartbeat feature that was submitted in a patch on 2011-12-31 which is before the RFC 6520 it's based on was created. By the same author as the RFC.
Code that is extremely obfuscated without reason.
PHK was right
150
u/tenpn Apr 09 '14
Can someone explain that in english?
123
u/sigzero Apr 09 '14
"OpenSSL is not developed by a responsible team."
Wow!
56
u/jgotts Apr 09 '14
Mr. de Raadt is correct. OpenSSL is a nasty piece of software. Just try doing anything with it using the command-line programs and that fact should become immediately obvious: Poor documentation, too many different intermediate file formats, and non-standard and obsolete command syntaxes.
OpenSSL has always struck me as a package written by mathematicians whose second job is programming. I know there are many mathematicians who are excellent programmers, but when programming is an afterthought to the underlying mathematics chances are you will produce poor-quality software
I hate to be so negative about such a useful piece of software. I think that OpenSSL could be refactored/reorganized to produce a really great piece of software. Mainly, they need to revise the command-line options to be modern (use GNU standards), write proper documenation, and as other people have said, improve the code base.
130
u/karlthepagan Apr 09 '14
Voodoo optimization: this is slow in one case 10 years ago. So, we will break the library for many years to come!
154
u/muyuu Apr 09 '14
Yep looking at that part of the code was a bit of a WTF moment. Also, there's a variable called "payload" where the payload length is stored... what kind of monster chose that name, I don't know.
84
u/ACTAadACTA Apr 09 '14
There should be an alternative to OpenSSL that is easy to use, formally verified and as small as possible.
I know, I'm a dreamer.
27
u/zalifer Apr 09 '14
The title is incorrect, so far as it suggests that Theo de Raadt said that.
As the formatting in reddit shows, Mike Small wrote the sentence quoted in the title.
75
u/[deleted] Apr 09 '14
There are two types of people who write open source code:
Those who have heard the music of the spheres and write in crystalline prose no mortal can ever understand, and those who think a quadruple indented 15 clause if/else tree is a valid way to deal with complexity.
56
u/[deleted] Apr 09 '14
That's insane. If I were writing a SSL library, security takes precedence over performance so long as it's still usable.
42
u/_4p3 Apr 09 '14
"Only two remote holes in the default install, in a heck of a long time!"
So, when will they update this?
3
u/bordumb Apr 10 '14
Probably built that way so that the NSA could have a nice backdoor to everything :)
16
u/kevwil Apr 09 '14
Theo de Raadt & Linus Torvalds - opinionated, blunt, maybe even rude, but absofuckinglutely right about almost every thing they've ever said or written. This is what separates them from the rest of us.
4
u/niknej Apr 09 '14
I think it is Dijkstra to whom the aphorism "All significant systems still contain bugs" is most commonly attributed, but I'll bet he was not the first to think of it. Nobody can realistically claim that openssl, much less the internet, is trivial.
So let's bite on the bullet. There are (still) security bugs in the net. We should be alert for them, and swat them when they come to light, but there is a limit to how much breast-beating they are worth. This bug is dead (or at least moribund, until people update their openssl). Next week, another bug!
2
u/skillcode Apr 09 '14
This is pretty worrying, especially if we consider the fact that the exploit has been out in the wild for a long, long time. I've patched up all my stuff, and wishing everyone else to do the same quickly.
2
u/stmfreak Apr 10 '14
Smart developers always seem to think they know better than whoever wrote the old code.
2
u/zvrba Apr 10 '14
Hah, I had a good hunch when I wondered how the damn thing didn't crash on so large (64kB, spanning a few pages) buffer overruns.
2
u/i-node Apr 09 '14
He is right. Anyone who has looked at openssl knows he is right. Even their make system doesn't properly track dependencies to build in parallel. (at least it didn't last time I checked) Many of the algorithms they implement are complicated enough most people assume they are correct (it is hard to audit a section of code for correctness when the algorithm is hard to follow) . This feature he shows however only works for the right allocator. Some people would still be affected but it is more likely the openssl team would find this bug had they not worked around the allocator.
2
u/partyboy690 Apr 09 '14
What surprises me by this bug is that a program like OpenSSL isn't that heavily unit tested, I mean the most basic unit test would catch this. It is a programming error and a classic C error too, I don't exactly know how OpenSSL works so forgive me if some of this comes as ignorant but surely this process would be working in its own virtual set of memory, if it did try and access cached memory outside of the virtual set the operating system would complain regardless if it used a bespoke memory allocation routine?
1
u/looneysquash Apr 09 '14
I'm not defending OpenSSL in general. I don't know enough about it's internals to comment on it.
But caching memory allocated by malloc() is a pretty common technique. It's not an unreasonable thing to do, and it does not automatically make someone an unreasonable developer.
Doing something like that unconditionally is usually better than doing it conditionally. Maybe some platform has a really fast malloc and it's not necessary, but if you have two code paths, then you have two code paths to debug. (In this case apparently they did support both ways, but the one that wasn't used unsurprisingly didn't work.)
1
u/hpzr24w Apr 09 '14
It's the sinister option.
1
u/GeorgeForemanGrillz Apr 10 '14
I agree with Theo here. They have the balls to ask for donations too. Fuck them.
1
u/matholio Apr 10 '14
Most of this is whoosh for me, but enjoyed reading the comments of mature coders talking able the perils if feeling smart.
1
u/SlobberGoat Apr 10 '14
a wooden stake being driven through OpenSSL's heart = HeartBleed
1
u/Andrey_Karpov_N Apr 16 '14
Some time ago, a vulnerability was revealed in OpenSSL, and I guess there's no programmer who hasn't been talking about it since then. I knew that PVS-Studio could not catch the bug leading to this particular vulnerability, so I saw no reason for writing about OpenSSL. Besides, quite a lot of articles have been published on the subject recently. However, I received a pile of e-mails, people wanting to know if PVS-Studio could detect that bug. So I had to give in and write this article: http://www.viva64.com/en/b/0250/
1
u/syncsynchalt Apr 09 '14
This email was a lot more confusing until I stopped parsing "openssl" as "openssh" (due to proximity to TdR).
-2
u/drguildo Apr 09 '14
Remember when that Debian developer "fixed" that OpenSSL Valgrind warning. Yeah. Some people shouldn't be allowed near a C compiler. Actually, can we just stop using C now, please?