| plnyyanks |
10-04-2014 23:44 |
Re: Heartbleed
Quote:
Originally Posted by cadandcookies
(Post 1372422)
maybe some of the network gurus around here have more details?
|
This specific exploit is actually not quite network related. It's more of a programming oversight (with huge implications). Basically, there's a part of the SSL protocol called the heartbeat, which allows for a connection to remain open over time - the client sends a little message to the server saying, "hey! don't kill my connection" and the server acknowledges it and sends some data back.
The way the protocol is defined, the client sends its packet of data and a number representing the size of that data as validation (something pretty common to do). However, openSSL doesn't check that the given size actually corresponds to the actual size of the payload - it just allocates a chuck of memory that sized and returns it. This means that if the user tells openSSL that the payload is bigger that it is, the server will actually dump a portion of its memory back (which can include things like private keys, passwords, etc.).
You can check the vulnerable code out here, and you can see it just does a memcpy and if you look at the surrounding code, those bounds aren't checked.
Quote:
/* Allocate memory for the response, size is 1 byte
* message type, plus 2 bytes payload length, plus
* payload, plus padding
*/
buffer = OPENSSL_malloc(1 + 2 + payload + padding);
bp = buffer;
/* Enter response type, length and copy payload */
*bp++ = TLS1_HB_RESPONSE;
s2n(payload, bp);
memcpy(bp, pl, payload);
|
Although the situation is different, the moral of the story remains the same...

|