The Heartbleed Bug, explained

In 2014, security researchers discovered a serious flaw in SSL, the encryption technology that secures the web.

What was the Heartbleed Bug?

The Heartbleed bug was a serious flaw in OpenSSL, encryption software that powers a lot of secure communications on the web. It was announced by computer security researchers on April 7, 2014.

Here’s how it worked: the SSL standard includes a heartbeat option, which allows a computer at one end of an SSL connection to send a short message to verify that the other computer is still online and get a response back. Researchers found that it’s possible to send a cleverly formed, malicious heartbeat message that tricks the computer at the other end into divulging secret information. Specifically, a vulnerable computer can be tricked into transmitting the contents of the server’s memory, known as RAM.

Ed Felten, a computer scientist at Princeton (and, disclosure, my former graduate advisor) told me in 2014 that attackers using the technique can “sort through that information by doing pattern matching to try to find secret keys, passwords, and personal information like credit card numbers.”

I don’t need to explain why exposing passwords and credit card numbers could be harmful. But exposing secret keys can be even worse. This is the information servers use to unscramble encrypted information it receives. If an attacker obtains a server’s private keys, it can read any information sent to it. It may even be able to use the secret key to impersonate the server, tricking users into divulging their password and other sensitive information.

Because the Heartbleed attack was generally focused on servers, there was nothing users could do to protect themselves when using a vulnerable website. But once a secure website had fixed the problem, users had to update their software to ensure that previously-captured passwords were not used for malicious purposes.

Which websites were affected?

Affected companies included Tumblr, Google, Yahoo, Intuit (makers of TurboTax), Dropbox, Netflix, and Facebook. All of these companies have since fixed the problem. Amazon.com was not affected, but Amazon Web Services, which is used by a huge number of smaller websites, was. Apple, Microsoft, PayPal, LinkedIn, eBay, Twitter, and AOL said they weren't affected.

Most banking and investment sites, including Bank of America, Chase, E-Trade, Fidelity, PNC, Schwab, US Bank, and Wells Fargo, were not affected. This might be because these companies used encryption software other than OpenSSL, or it might be because they hadn’t upgraded to the latest version. Ironically, companies who were running a version of OpenSSL more than two years old in April 2014 were not affected by the Heartbleed bug.

What is SSL?

SSL, short for Secure Sockets Layer, is a family of encryption technologies that allow web users to protect the privacy of information they transmit over the internet.

When you visit a secure website such as Gmail.com, you’ll see a lock next to the URL, indicating that your communications with the site are encrypted. Here’s what that looks like in Google’s Chrome browser:

Screen_shot_2014-04-08_at_10

That lock is supposed to signal that third parties won’t be able to read any information you send or receive. Under the hood, SSL accomplishes that by transforming your data into a coded message that only the recipient knows how to decipher. If a malicious party is listening to the conversation, it will only see a seemingly random string of characters, not the contents of your emails, Facebook posts, credit card numbers, or other private information.

SSL was introduced by Netscape in 1994. In recent years, there has been a trend toward major online services to using encryption by default. Today, Google, Yahoo, and Facebook all use SSL encryption by default for their websites and online services.

When implemented correctly, SSL is believed to be highly secure. But 2014 was a bad year for SSL security; Heartbleed wasn’t the only security flaw uncovered that year. In February, a serious flaw was discovered in Apple’s implementation of SSL. The next month a flaw was found in another SSL implementation that was popular with open source operating systems.

What’s OpenSSL?

OpenSSL is software that allows computers to communicate using the SSL encryption standards. It’s an open source project created and maintained by volunteers. First released in 1998, it has become one of the most popular SSL implementations in the world.

OpenSSL is widely used. One reason for this is that it has been incorporated into various other software products. For example, two of the most popular web servers software packages, known as Apache and nginx, both use OpenSSL to encrypt websites.

At the time of the Heartbleed attack, the OpenSSL website listed just 15 active developers, most of whom contributed to the project on a volunteer basis. But not all changes to the OpenSSL software are written by these 15 people. Rather, these developers help to filter and organize suggested changes from a larger community of people who make occasional contributions.

Considering that high-profile commercial software projects often have dozens or even hundreds of people working on them, it’s not surprising that the OpenSSL team didn’t notice the subtle Heartbleed bug when they introduced a new version of the software in 2012.

After the Heartbleed bug was discovered, several large tech companies pooled their resources to fund greater efforts to secure OpenSSL and other open source software that forms the internet’s core infrastructure.

How does the Heartbleed attack work?

The SSL standard includes a “heartbeat” option, which provides a way for a computer at one end of the SSL connection to double-check that there’s still someone at the other end of the line. This feature is useful because some internet routers will drop a connection if it’s idle for too long. In a nutshell, the heartbeat protocol works like this:

Heartbleed_good

The heartbeat message has three parts: a request for acknowledgement, a short, randomly-chosen message (in this case, “banana”), and the number of characters in that message. The server is simply supposed to acknowledge having received the request and parrot back the message.

The Heartbleed attack takes advantage of the fact that the server can be too trusting. When someone tells it that the message has 6 characters, the server automatically sends back 6 characters in response. A malicious user can take take advantage of the server’s gullibility:

Heartbleed_bad

Obviously, the word “giraffe” isn’t 100 characters long. But the server doesn’t bother to check before sending back its response, so it sends back 100 characters. Specifically, it sends back the 7-character word “giraffe” followed by whichever 93 characters happen to be stored after the word “giraffe” in the server’s memory. Computers often store information in a haphazard order in an effort to pack it into its memory as tightly as possible, so there’s no telling what information might be returned. In this case, the bit of memory after the word “giraffe” contained sensitive personal information belonging to user John Smith.

In the real Heartbleed attack, the attacker doesn’t just ask for 100 characters. The attacker can ask for around 64,000 characters of plain text. And it doesn’t just ask once, it can send malicious heartbeat messages over and over again, allowing the attacker to get back different fragments of the server’s memory each time. In the process, it can gain a wealth of data that was never intended to be available to the public.

The fix for this problem is easy: the server just needs to be less trusting. Rather than blindly sending back as much data as is requested, the server needs to check that it's not being asked to send back more characters than it received in the first place. That's exactly w hat OpenSSL's fix for the Heartbleed Bug does.

Who discovered the vulnerability?

It was discovered independently by researchers at Codenomicon and Google Security. Codenomicon created a user-friendly website about the vulnerability, helping to rapidly spread awareness.

To minimize the damage from the disclosure, the researchers worked with the OpenSSL team and other key insiders to prepare fixes before the problem was announced publicly.

How did the Heartbleed bug get added to OpenSSL?

The flawed code was added to the experimental version of SSL at the end of 2011 and released to the public in March 2012. The flawed software patch was submitted by a German man named Robin Seggelmann.

“I was working on improving OpenSSL and submitted numerous bug fixes and added new features,” he told the Sydney Morning Herald. “In one of the new features, unfortunately, I missed validating a variable containing a length.”

The submission was reviewed by an OpenSSL developer, but neither man noticed that the code could be exploited to trick servers into leaking the contents of memory.

What information can you get with a Heartbleed attack?

The Heartbleed attack works by tricking servers into leaking information stored in their memory. So any information handled by web servers is potentially vulnerable. That includes passwords, credit card numbers, medical records, and the contents of private email or social media messages.

Attackers can also get access to a server’s private encryption key. That could allow the attacker to unscramble any private messages sent to the server and even impersonate the server.

Have there been any successful attacks using the Heartbleed bug?

Yes, the security firm Mandiant reports that it has observed a Heartbleed attack occurring “in the wild.” The attack targeted a Virtual Private Network service at an unnamed organization, gaining access to its internal corporate network.

The type of attack is particularly scary because it shows that hackers are finding the parts of the internet are least likely to have been updated to protect against Heartbleed.

Major organizations like Google and Tumblr got much of the press after the Heartbleed bug was discovered. But these are huge firms with thousands of engineers. They had the resources and expertise to fix their software and harden their defenses quickly.

But OpenSSL is used in a wide variety of special-purpose networking appliances. The software on these network appliances may not be as easy to upgrade as a general-purpose web server. And these smaller organizations might not even realize that their devices are running OpenSSL in the first place, much less know how to fix them.

It’s hard to be sure how broadly the Heartbleed attack was exploited. Hackers who have stolen users’ passwords, credit card numbers, and other private data might decide to lie low for a while before trying to take advantage of this information. And if they do eventually use users’ private information for fraudulent purposes, we might not know if they got the information through a Heartbleed attack or some other tactic.

What is being done to prevent future problems like Heartbleed?

The scale of the Heartbleed attack served as a wake-up call for the Internet community. In response, more than a dozen technology companies have pledged to contributed to the Core Infrastructure Initiative. Organized by the non-profit Linux Foundation, the project will direct funding to widely-used open source projects such as OpenSSL that are not adequately funded.

The foundation told Ars Technica in late April 2014 that it had already received $3.9 million in donations from major technology companies including Amazon, Microsoft, Google, and Facebook.

Also funding internet security efforts is the Hewlett Foundation, founded by HP co-founder William Hewlett and his wife. In a remarkable stroke of foresight, the foundation announced a $20 million “cyber initiative” on April 2, 2014, a few days before the public disclosure of the Heartbleed initiative. The foundation hopes to help “develop a network of experts working to keep the Internet secure, open, and well governed.”

These investments represent a small step toward rectifying a massive shortfall in funding for internet security. The web accounts for billions of dollars of commerce; even after these $24 million in philanthropic investments, there’s still a serious need to devote more resources toward securing the web.

You’ve read 1 article in the last month

Here at Vox, we believe in helping everyone understand our complicated world, so that we can all help to shape it. Our mission is to create clear, accessible journalism to empower understanding and action.

If you share our vision, please consider supporting our work by becoming a Vox Member. Your support ensures Vox a stable, independent source of funding to underpin our journalism. If you are not ready to become a Member, even small contributions are meaningful in supporting a sustainable model for journalism.

Thank you for being part of our community.