News for hackers. Stuff that matters.
Re:OpenSSL Security Advisory: TLS heartbeat read overrun by nly on Monday April 07, 2014 @04:01PM (#7549027)
"Don't roll your own parsers" should really be up there with "Don't roll your own crypto". This advisory is scant on details, but this extension protocol[0] neither looks complex nor beyond mechanical code generation to me. Just simple enough to be dangerous. And it's pretty new, so this must be recently authored vulnerable code.

[0] http://tools.ietf.org/html/draft-ietf-tls-dtls-heartbeat-04

Re:OpenSSL Security Advisory: TLS heartbeat read overrun by iso8859-1 on Monday April 07, 2014 @04:55PM (#7549424)
Re:OpenSSL Security Advisory: TLS heartbeat read overrun by osivertsson on Tuesday April 08, 2014 @01:45AM (#7551617)
Ouch, pretty basic lack of bounds checking.

Even though the code got better with this fix I still wouldn't accept code that looks like this in a review. Why are 1, 2, 3, 16 not defines? What's up with the code duplication between files? Where are the unit-tests?

I'm starting to feel that a lot of software that has been around for 10+ years and is commonly used does not live up to current best practices regarding writing good system-level software.

Re:OpenSSL Security Advisory: TLS heartbeat read overrun by rlpb on Tuesday April 08, 2014 @07:09AM (#7552618)
> I'm starting to feel that a lot of software that has been around for 10+ years and is commonly used does not live up to current best practices regarding writing good system-level software.

I get the impression that this applies to openssl far more than other software. The code base is a mess, and it's security sensitive. So people dare not touch it.

It's a shame that there isn't a better incentive for this particular code base to be fixed.

Re:OpenSSL Security Advisory: TLS heartbeat read overrun by simias on Tuesday April 08, 2014 @07:12AM (#7552634)

    if (1 + 2 + 16 > s->s3->rrec.length)
    if (1 + 2 + payload + 16 > s->s3->rrec.length)
Come on. At least use a macro or something.

This always makes me cringe during code reviews.

Re:OpenSSL Security Advisory: TLS heartbeat read overrun by dhimes on Tuesday April 08, 2014 @09:55AM (#7553396)
Yep, and no braces after the 'if' statement in the patch. Even after the previous ssl vuln (I thought it was gnutls- struggling to find the relevant hn discussion) was caused by an omission of braces after the 'if' statement.
Re:OpenSSL Security Advisory: TLS heartbeat read overrun by saurik on Tuesday April 08, 2014 @11:52AM (#7554123)
You are thinking of "goto fail", a bug in Apple's Security framework. I would not claim that was "caused" by a lack of braces: even having the braces, that bug--in addition to a wide class of similar bugs--is still quite possible, even if in a few models of how the bug was caused it becomes slightly less likely. The best place to lay blame for that kind of error is a stubborn insistence that error handling should involve boilerplate return value checks strewn throughout the code, with no attempt at abstraction or structure: it leads to numerous potential mistakes. Please read the various discussions attached to this article that made this claim:

https://news.ycombinator.com/item?id=7318039

Re:OpenSSL Security Advisory: TLS heartbeat read overrun by dhimes on Tuesday April 08, 2014 @12:27PM (#7554399)
Yes, that is exactly what I was thinking of. Thanks for the link. The discussion I was recalling is here

https://news.ycombinator.com/item?id=7282005

but the thread is a lot heftier now.

Re:OpenSSL Security Advisory: TLS heartbeat read overrun by Jare on Tuesday April 08, 2014 @08:44AM (#7552994)
I felt much better about having a fix before I looked at the actual code. It is functionally secure (looks right to me and thousands of others by now), but the way it is written would guarantee you an instant fail in an exam or interview.
Re:OpenSSL Security Advisory: TLS heartbeat read overrun by jlgaddis on Monday April 07, 2014 @05:54PM (#7549829)
2011-12-31, it looks like, so it's been there for a couple of years already (introduced between 1.0.0f and 1.0.1):

http://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=...

Re:OpenSSL Security Advisory: TLS heartbeat read overrun by ge0rg on Tuesday April 08, 2014 @06:47AM (#7552555)
Wow, a code change introduced around New Year's Eve (depending on timezone), and authored by Robin Seggelmann, who also brought us DTLS-SCTP.
Re:OpenSSL Security Advisory: TLS heartbeat read overrun by hackinthebochs on Tuesday April 08, 2014 @09:50AM (#7553355)
I've been thinking along these lines for a long time now, that parsing is such a critical activity that we should treat it with far more reverence than we do. Ideally, we would define languages to describe the format of the data that we want to parse (something like a BNF perhaps), and the OS/environment would parse it and populate variables/provide a dictionary in response. Ensuring that the input to your algorithm is exactly as expected is such a critical task that no one should ever be doing it manually.
Re:OpenSSL Security Advisory: TLS heartbeat read overrun by zurn on Tuesday April 08, 2014 @02:48AM (#7551803)
> "Don't roll your own parsers" should really be up there with "Don't roll your own crypto".

.. and if you do, don't do it in a highly memory-unsafe language. Espcially when it's for a security critical piece of central internet infrastructure!

Re:OpenSSL Security Advisory: TLS heartbeat read overrun by danielweber on Tuesday April 08, 2014 @09:40AM (#7553300)
How do the Ruby-YAML and Python-Pickle vulnerabilities get cataloged?
Re:OpenSSL Security Advisory: TLS heartbeat read overrun by eliteraspberrie on Monday April 07, 2014 @04:08PM (#7549083)
Looks like a good use case for Hammer: https://github.com/UpstandingHackers/hammer
Re:OpenSSL Security Advisory: TLS heartbeat read overrun by nly on Monday April 07, 2014 @04:40PM (#7549321)
Looks interesting, but static code generation along the lines of Ragel (but more oriented toward binary structures like Protocol Buffers) would be a lot better for performance.