The Heartbleed bug refers to a critical bug in the OpenSSL cryptographic library. This bug was publicly revealed on Monday, 7 April 2014. Due to a programming error in OpenSSL versions 1.0.1 through 1.0.1f — meaning the bug had existed for two years — attackers could read random server memory by sending specially prepared HeartbeatRequest messages to an affected server.
OpenSSL is a very commonly used library to implement SSL/TLS, a cryptographic protocol not only used to secure web traffic but also for mail clients and much more. Only the user and the server can read the communication. On the web the protocol is https:// (HTTP Secure), instead of the open http:// standard. SSL is often used to protect sensitive web traffic, such as login requests, which contains the user names and passwords in the requests. The server sends a certificate to the browser before the secure connection is established. If the certificate is registered the browser accepts it automatically, otherwise the user gets a popup to accept or reject this insecure certificate.
A vulnerability that lets an attacker read random clumps of memory on the server would possibly let an attacker find recent username/password requests, allowing them to gain unauthorized access to user accounts. Even worse, this vulnerability could read the server's private key, enabling anyone to impersonate the server and/or decrypt any future traffic that relies on that key, and any previously-obtained prior traffic also, unless a "perfect forward secrecy" ciphers is used, which is currently rare. Furthermore, the Heartbleed exploit occurs during the handshake phase of setting up a connection, so no traces of it are logged, i.e. you can be attacked and never be the wiser.
In the last panel, Megan interprets Cueball's question ("is everything compromised?") expansively. She responds that, being a computer bug, Heartbleed can only affect information which is stored on computers. Cueball concludes that information recorded in analog media, such as that written on paper or etched in clay tablets, is safe. Megan adds that imaginations are also unaffected by Heartbleed, and Cueball is reassured. The reader may wonder how our society would fare in the face of the destruction of all electronically stored information, but having our imaginations intact is certainly reassuring.
The title text cites the Tears in rain soliloquy, the dying words of the replicant and main antagonist Roy Batty (played by Rutger Hauer) in the 1982 film Blade Runner, implying that the 64KiB HeartBleed buffer is so complete it includes memories from replicant brains. This is ironic as in the soliloquy, Roy Batty stated "All those moments will be lost in time".
The title text also suggests to patch OpenSSL oneself, which might refer to the patched version of OpenSSL by Debian, which turned out to be vulnerable in 2008, and was the topic of 424: Security Holes.
In addition to the below, see xkcd's explanation in the next comic.
Transport Layer Security (TLS), the successor to SSL, is a protocol that provides end-to-end encryption for data transmitted over the internet, and is described in RFC 5246. The Heartbeat extension to TLS introduced in 2012 (described in RFC 6520) provides a protocol for keeping an encrypted TLS session alive (preventing inactivity timeouts), so you do not have to do a costly TLS handshake with the server for subsequent transfer of information.
The Heartbeat protocol involves the client sending a packet with an arbitrary payload (often a random 16 to 32 byte number) that the server periodically sends back to the client to tell the client that the TLS session is still alive. When the client sends the packet to a vulnerable version of OpenSSL, the OpenSSL server reads a
payload_size from the header sent by the client. This is a 2-byte number (0 to 0xffff=65535) that is supposed to describe the size of the payload. The OpenSSL library writes the payload to memory, but it does not check that the size of the payload written to memory matches the
payload_size taken from the client's header. When the vulnerable server sends back the Heartbeat KeepAlive response to the client, it will readout
payload_size number of bytes and send them back to the client. If you send a payload that is actually 16 bytes, but claims it is 0xffff bytes you will read the next 64KiB of memory of the vulnerable process starting from wherever the payload was written. An attacker can repeat this attack many times and can do this attack early in the TLS handshake, so the attack will not in any way be logged unless they are logging every incoming packet which is not typical and would result in many passwords being logged. As private keys often have an identifiable format, it is often possible for an attacker to find the private TLS key, so if they eavesdrop on network traffic they can decrypt and/or alter it. For more detailed information see: 1, 2, 3.
It is worth noting that modern operating systems use a virtual memory abstraction above physical memory. This means every process can only access memory assigned to it, so it would be impossible for a vulnerable web server to read memory assigned to another process (like a text editor that has erotic fan fiction stored to memory) on the same computer. For more info, see: 4.
It also should be noted that this heartbleed bug only affects certain versions of OpenSSL, and does not affect other TLS/SSL implementations, or OpenSSH which does not even use the TLS protocol, but uses the SSH-2 protocol (described in RFC 4251). SSH is typically used for remote logins on unix and linux computers.
Vulnerable sysadmins need to update to a patched version of OpenSSL or one with the Heartbeats disabled. Unless their TLS keys were protected by hardware, they probably also need to revoke their old TLS keys, and generate new TLS keys.
Users of vulnerable systems should change their passwords after the sysadmins have revoked their old key and issued new ones (as their passwords may have been compromised). Users can check whether a given website is vulnerable via a Heartbleed test also available as open source. The Lastpass heartbleed diagnostic also indicates whether the signature on the TLS key predates the publication of the heartbleed vulnerability.
The vulnerable commit was introduced Dec 31st, 2011 by Robin Seggelmann, the first co-author of the heartbeats RFC, and went live when OpenSSL version 1.0.1 was released on 2012-03-14 and the vulnerability was widely announced 2014-04-07.
- Megan: Heartbleed must be the worst web security lapse ever.
- Cueball: Worst so far. Give us time.
- Megan: I mean, this bug isn't just broken encryption.
- Megan: It lets website visitors make a server dispense random memory contents.
- Megan: It's not just keys. It's traffic data. Emails. Passwords. Erotic fanfiction.
- Cueball: Is everything compromised?
- Megan: Well, the attack is limited to data stored in computer memory.
- Cueball: So paper is safe. And clay tablets.
- Megan: Our imaginations, too.
- Cueball: See, we'll be fine.