How to patch your server against The Heartbleed Bug

What is the Heartbleed Bug?

The Heartbleed Bug is a serious vulnerability in the popular OpenSSL cryptographic software library. This weakness allows stealing the information protected, under normal conditions, by the SSL/TLS encryption used to secure the Internet. SSL/TLS provides communication security and privacy over the Internet for applications such as web, email, instant messaging (IM) and some virtual private networks (VPNs).
The Heartbleed bug allows anyone on the Internet to read the memory of the systems protected by the vulnerable versions of the OpenSSL software. This compromises the secret keys used to identify the service providers and to encrypt the traffic, the names and passwords of the users and the actual content. This allows attackers to eavesdrop on communications, steal data directly from the services and users and to impersonate services and users.

Before you start

Check if your OpenSSL version is vulnerable to the exploit. You can check it by typing in your terminal: openssl version
The result should look something like this:
# openssl version
OpenSSL 1.0.1g 7 Apr 2014

Since we at Hackers Chronicle already patched our systems at the time of writing this guide, your result will probably be different.

What versions are vulnerable?

Status of different versions:
  • OpenSSL 1.0.1 through 1.0.1f (inclusive) are vulnerable
  • OpenSSL 1.0.1g is NOT vulnerable
  • OpenSSL 1.0.0 branch is NOT vulnerable
  • OpenSSL 0.9.8 branch is NOT vulnerable

Bug was introduced to OpenSSL in December 2011 and has been out in the wild since OpenSSL release 1.0.1 on 14th of March 2012. OpenSSL 1.0.1g released on 7th of April 2014 fixes the bug.

Some operating system distributions that have shipped with potentially vulnerable OpenSSL version:
  • Debian Wheezy (stable), OpenSSL 1.0.1e-2+deb7u4
  • Ubuntu 12.04.4 LTS, OpenSSL 1.0.1-4ubuntu5.11
  • CentOS 6.5, OpenSSL 1.0.1e-15
  • Fedora 18, OpenSSL 1.0.1e-4
  • OpenBSD 5.3 (OpenSSL 1.0.1c 10 May 2012) and 5.4 (OpenSSL 1.0.1c 10 May 2012)
  • FreeBSD 8.4 (OpenSSL 1.0.1e) and 9.1 (OpenSSL 1.0.1c)
  • NetBSD 5.0.2 (OpenSSL 1.0.1e)
  • OpenSUSE 12.2 (OpenSSL 1.0.1c)
Operating system distribution with versions that are not vulnerable:
  • Debian Squeeze (oldstable), OpenSSL 0.9.8o-4squeeze14
  • SUSE Linux Enterprise Server


open your terminal and type in the following:
#sudo apt-get update
#sudo apt-get install -y libssl1.0.0 openssl
#openssl version -a
//confirm the "built on" date is >= 2014-04-07
sudo lsof -n | grep ssl | grep DEL
//restart all listed services. Repeat this until no results are returned


Open terminal and copy or type the following:
#wget http://security.debian.org/pool/updates/main/o/openssl/libssl1.0.0-dbg_1.0.1e-2+deb7u5_amd64.deb
#wget http://security.debian.org/pool/updates/main/o/openssl/openssl_1.0.1e-2+deb7u5_amd64.deb
#wget http://security.debian.org/pool/updates/main/o/openssl/libssl1.0.0_1.0.1e-2+deb7u5_amd64.deb
#wget http://security.debian.org/pool/updates/main/o/openssl/libssl-dev_1.0.1e-2+deb7u5_amd64.deb

#dpkg -i openssl_1.0.1e-2+deb7u5_amd64.deb
#dpkg -i libssl1.0.0_1.0.1e-2+deb7u5_amd64.deb
#dpkg -i libssl1.0.0-dbg_1.0.1e-2+deb7u5_amd64.deb
#dpkg -i libssl-dev_1.0.1e-2+deb7u5_amd64.deb

#/etc/init.d/apache2 restart
#/etc/init.d/ssh restart


Open terminal and copy or type the following:
#yum clean all && yum update "openssl*"

Take note and ensure that it’s specifically openssl-1.0.1e-16.el6_5.7 (or later) being installed. As this update has just been released, your yum mirror may not have this package yet. If your yum mirror/repository does not yet have this update, you can download and install the RPMs manually from another CentOS yum repository.

After updating the packages, run the following command to see what processes still have the old, deleted OpenSSL libraries open:
#lsof -n | grep ssl | grep DEL

You must restart each process that still has the old libraries open.

Examples of processes that may still have the old libraries open:
  • mysql
  • postfix
  • webmin
  • openvpn
  • osad
  • nrpe

Fedora/Red Hat

Open terminal and copy or type the following:
$ yum update openssl

Restart services that rely on OpenSSL
$ lsof | grep libssl | awk '{print $1}' | sort | uniq

Test your website against Heartbleed Bug

Heartbleed Test - provided by possible.lv
Heartbleed Test - provided by filippo.io 

Source: Scan Arch

Post a Comment Blogger