This is a Canonical Question about understanding and remediating the Heartbleed security issue.
What exactly is CVE-2014-0160 AKA "Heartbleed"? What is the cause, what OSs and versions of OpenSSL are vulnerable, what are the symptoms, are there any methods to detect a successful exploit?
How can I check to see if my system is affected? How can this vulnerability be mitigated? Should I be concerned that my keys or other private data have been compromised? What other side effects should I be concerned about?
First, before freaking out, be sure that you understand whether or not this vulnerability actually applies to you. If you have a server, but have never actually had any applications using TLS, then this is not a high-priority thing for you to fix. If, on the other hand, you have ever had TLS-enabled applications, well then you're in for a treat. Read on:
It's a big fricking mess, that's what it is. In short, a remotely-exploitable vulnerability was discovered in OpenSSL versions 1.0.1 through 1.0.1f through which an attacker can read certain parts of system memory. Those parts being that which hold sensitive data such as private keys, preshared keys, passwords and high valued corporate data among other things.
The bug was independently discovered by Neel Mehta of Google Security (March 21, 2014) and Finnish IT security testing firm Codenomicon (April 2, 2014).
Well, errant code in OpenSSL. Here is the commit that introduced the vulnerability, and here is the commit that fixed the vulnerability. The bug showed up in December of 2011 and was patched today, April 7th, 2014.
The bug can also be seen as a symptom of a larger problem. The two related problems are (1) what process are in place to ensure errant code is not introduced to a code base, and (2) why are the protocols and extensions so complex and hard to test. Item (1) is a governance and process issue with OpenSSL and many other projects. Many developers simply resist practices such as code reviews, analysis and scanning. Item (2) is being discussed on the IETF's TLS WG. See Heartbleed / protocol complexity.
I won't speculate on whether this was truly a mistake or possibly a bit of code slipped in on behalf of a bad actor. However, the person who developed the code for OpenSSL states it was inadvertent. See Man who introduced serious 'Heartbleed' security flaw denies he inserted it deliberately.
As mentioned above, any operating system that is using, or application that is linked against OpenSSL 1.0.1 through 1.0.1f.
This is the scary part. As far as we know, there is no known way to detect whether or not this vulnerability has been exploited. It is theoretically possible that IDS signatures will be released soon that can detect this exploit, but as of this writing, those are not available.
There is evidence that Heartbleed was being actively exploited in the wild as early as November, 2013. See the EFF's Wild at Heart: Were Intelligence Agencies Using Heartbleed in November 2013? And Bloomberg reports the NSA had weaponized the exploit shortly after the vulnerability was introduced. See NSA Said to Exploit Heartbleed Bug for Intelligence for Years. However, the US Intelligence Community denies Bloomberg's claims. See IC ON THE RECORD.
If you are maintaining OpenSSL on your system, then you can simply issue
openssl version
:If the distribution is maintaining OpenSSL, then you probably can't determine the version of OpenSSL due to back patching using
openssl
command or the package information (for example,apt-get
,dpkg
,yum
orrpm
). The back patching process used by most (all?) distributions only uses the base version number (for example, "1.0.1e"); and does not include an effective security version (for example, "1.0.1g").There's an open question on Super User to determine the effective security version for OpenSSL and other packages when packages are backpatched. Unfortunately, there are no useful answers (other than check the distro's website). See Determine Effective Security Version when faced with Backpatching?.
As a rule of thumb: if you have ever installed one of the affected versions, and have ever run programs or services that linked against OpenSSL for TLS support, then you are vulnerable.
Within hours of the Heartbleed announcement, several people on the internet had publicized publicly-accessible web applications that supposedly could be used to check a server for the presence of this vulnerability. As of this writing, I have not reviewed any, so I won't further publicize their applications. They can be found relatively easily with the help of your preferred search engine.
Upgrade to a non-vulnerable version and reset or re-secure vulnerable data. As noted on the Heartbleed site, appropriate response steps are broadly:
For a more detailed analysis and answer, see What should a website operator do about the Heartbleed OpenSSL exploit? on the Security Stack Exchange.
Absolutely. Systems Administrators need to assume that their servers which used vulnerable OpenSSL versions are indeed compromised and respond accordingly.
Shortly after the vulnerability was disclosed, Cloudfare offered a challenge to see if a server's private key could be recovered in practice. The challenge was independently won by Fedor Indutny and Ilkka Mattila. See The Heartbleed Challenge.
Link dump, for those looking for more details:
A rather detailed timeline of the disclosure events can be found at Heartbleed disclosure timeline: who knew what and when.
If you are a programmer and are interested in various programming tricks like detecting a Heartbleed attack through OpenSSL's
msg_cb
callback, then see OpenSSL's Security Advisory 2014047.A simple explanation of the bug, by XKCD:
Ubuntu 12.04, 12.10, and 13.10
Ubuntu has issued USN-2165-1, which states that updated packages are now available in the archives. Run the following two commands to grab the fix.
Ubuntu 14.04
I have uploaded a Debian package containing the new release (1.0.1g) to a PPA I have set up for this purpose. These three commands will add my PPA to your system, update the list of available packages, and upgrade everything:
Note: the PPA also provides packages for Ubuntu 12.04 and 13.10, just in case you prefer to actually run the new version (1.0.1g) instead of just using the patched versions in the archives.
Ubuntu 10.04
This is an LTS Version, the server version is still supported and receives security updates. But the heartbleed vulnerability did not affect the openssl package of a standard installation of ubuntu 10.04, because the version is below 1.0.1.
The desktop version has reached end of life and needs to be upgraded / reinstalled.
Ubuntu 13.04 and other outdated versions
Ubuntu 13.04 had a very short support cycle which you might not expect. It has reached end of life already and does not receive security updates any more. It should long have been upgraded. If still someone is using it, please upgrade now, either from scratch or it can be upgraded non-destructive to 13.10 following this easy procedure: http://www.tecmint.com/upgrade-ubuntu-13-04-raring-ringtail-to-ubuntu-13-10-saucy-salamander/ After the upgrade the system receives the heartbleed patch from 13.10.
For all other outdated ubuntu versions it means basically a fresh install is necessary.
Verify that the patch was applied
Essentially, run
openssl version -a
and make sure that the build date is April 7, 2014 or later, but see more here.Reboot
The best way to make sure all services depending on OpenSSL are restarted is to reboot.
RedHat 6.5 and CentOS 6.5
These are vulnerable. RedHat's erratum RHSA-2014-0376 says there are patched libraries available, and anyone affected should upgrade at the earliest opportunity.
At the time of writing, CentOS did not yet have a fixed version, but Karanbir Singh's posting to CentOS-announce says that they've produced an updated version of openssl (
openssl-1.0.1e-16.el6_5.4.0.1
, note the last four digits which are important) that has the exploitable TLS command disabled, and that can be safely applied as it will be overwritten by a fixed version when it is eventually released.The temporarily-fixed version doesn't seem to have made it onto all the mirrors yet, but is in the main repository at http://mirror.centos.org/centos/6/updates/x86_64/Packages/ (and similarly for i686).
Edit: as Iain says, there does now appear to be a fully-patched version for C6.5, and it seems to have been pushed around the mirrors in a hurry. A straight
yum update
got it for my servers; it'sopenssl-1.0.1e-16.el6_5.7
.Versions of RH6 and C6 prior to 6.5
These are not vulnerable. According to this advisory from Red Hat,
Karanbir Singh's posting to CentOS-announce is equally clear about versioning:
Debian Wheezy
Debian has issed DSA-2896-1 and patched libraries are available here. A shell script is available here.
1. Patch
Apt-get repository was updated so now patched libraries are available via
apt-get update && apt-get upgrade
Alternatively (not recommended) the packages can be upgraded manually:
2. Restart server/services
For best protection restart the entire server or if server can't be offline then restart needed services.
3. Check OpenSSL Version
FreeBSD 10.0 or openssl from ports
The FreeBSD security team has issued an advisory regarding CVE-2014-0160 (aka "Heartbleed") and : FreeBSD-SA-14:06.openssl
Updating FreeBSD
Updating FreeBSD via a binary patch
Systems running a RELEASE version of FreeBSD on the i386 or amd64 platforms can be updated via the freebsd-update(8) utility:
Updating FreeBSD from the sources
Download the relevant patch from the location below, and verify the detached PGP signature using your PGP utility.
Execute the following commands as root:
Recompile the operating system
using buildworld and installworld as described in the FreeBSD handbook.
Update the openssl port with minimum version 1.0.1_10
Restart all daemons using the library, or reboot the system
Act as if your system has been compromised, re-issue all your ssl keys and/or certificates and potentially leaked information (see EEAA more general answer).
FreeBSD 9.x and FreeBSD 8.x
These system are not vulnerable to the Heartbleed issue by default, as relying on older 0.9.x version of the openssl library, unless you installed openssl from the ports (see upstairs).
If these systems are not vulnerable to the Heartbleed issue, it might be wise to upgrade your system rather sooner than later due to another local vulnerability (see FreeBSD-SA-14:06.openssl and the "FreeBSD 10.0" section upstairs):
Note:
The original Heartbleed advisory lists FreeBSD 8.4 and 9.1 as being potentially vulnerable. This is not true due to the lack of Heartbeat Extension (default FreeBSD openssl library being version 0.9.x).
I'd like to point out that private keys are not the only assets that should be considered compromised. The bug has the potential to leak any memory running in the same address space (i.e., the same process) as OpenSSL. Therefore, if you are running a server process where a vulnerable version of OpenSSL is statically or dynamically linked, any piece of information that that process has ever handled, including passwords, credit card numbers, and other personal data, should be considered potentially compromised.
I found it next to impossible to determine the versions of SSL in use on several of the appliances I work with. Although it's technically not mitigation being able to ID currently vulnerable hosts was at the top of my list.
I put together a small VM that will perform checks against arbitrary hosts and ports using FiloSottile's test module. On preliminary glance the code looks sound.
The release of the completed VM is here. It's in VMX format.
Words of Warning
This script and VM will only show the current status of your systems. It's entirely possible that at some point in the past that your systems were in a vulnerable state and could have been been abused.
Something showing up here is definitely a high priority to fix but it does not get you off the hook for applying updates and changing all your keys.
Amazon Linux (Linux distro used in Amazon EC2)
https://aws.amazon.com/amazon-linux-ami/security-bulletins/ALAS-2014-320/
Issue Overview: A missing bounds check was found in the way OpenSSL handled TLS heartbeat extension packets. This flaw could be used to reveal up to 64k of memory from a connected client or server.
Affected Versions: Any Amazon Linux AMI on which openssl 1.0.1 is installed, which is any Amazon Linux AMI 2013.03 or later, and any Amazon Linux AMI that has upgraded to 2013.03 or later. OpenSSL is installed by default on the Amazon Linux AMI.
Affected Packages: openssl
Issue Correction: Run yum update openssl to update your system. Once the new package is installed, it is required that you either manually restart all services that are using openssl, or that you reboot your instance. While the new package is still named openssl-1.0.1e, it does contain the fix for CVE-2014-0160.
New Packages: i686:
x86_64: