On April 7, 2014, OpenSSL received a fix to a very popular and controversial vulnerability The Heartbleed bug. On that day, over half a million web servers were found to be vulnerable. Fortunately, that number is steadily decreasing and just like every other exploit, the Heartbleed bug is now out in the wild and the epidemic may never be fully eliminated (A hacker can dream, right?)
This vulnerability allows a hacker to extract information from a server’s memory which may contain authentication credentials, cookies, the server’s private key (even the admin password), and personally identifiable info (PII) that could be used for identity theft. The biggest websites on the internet were vulnerable. Facebook, Google, Twitter, Instagram, Yahoo, Pinterest, Tumblr, Dropbox and a few million more. All these websites were quick to announce, within a few weeks, that they’ve successfully patched the bug. What they didn’t announce, is that this vulnerability existed even 2 years ago and only now came to light. This is also part of the reason users were recommended to change all passwords everywhere. The NSA has (allegedly) been using this vulnerability for years to exploit websites.
Also Read: XSS Attack
OpenSSL is an encryption library used in HTTPS (secure HTTP)
If you ever notice URL bar after typing the address, say “google.com” you’ll see that it automatically changes to “https://www.google.com”. That is the job of OpenSSL. OpenSSL basically encrypts all communication between the server and the client while it takes place through the HTTPS URL. This makes all the password sniffing cookie stealing hacks impossible (sad face).
OpenSSL uses a handshake, or more popularly, a “heartbeat” that echoes back a signal to verify that the data was received correctly, during communication. It’s a bit like double checking whether the message was successfully received or not (Like the two tick marks you can see on WhatsApp messages).
Also Read: Latest Carding Dorks 2017
What is Heartbleed Bug?
The appropriately named Heartbleed bug vulnerability enables a hacker to trick OpenSSL by sending a message that is misinterpreted by the server running OpenSSL. Which then actually sends back the real data without any questions asked. The exact details are a bit technical. But thanks to Metasploit we don’t need to worry about them. Roughly translated, a single byte of data is sent to the server telling it that we actually sent 64K bytes of data. The server will then send back 64K bytes of data to be checked and echoed back.
After this ‘heartbeat’, the server again sends 64K of random data from its memory. That 1 byte has the buggy requests which confuses the server making it give up random information. So, with every ‘heartbeat’ we get 64Kb of private information (That’s enough for ~64,000 characters in plain unencrypted text. A lot of it will be rubbish but still enough for A LOT of accounts and passwords)
Also Read: Metasploit Tools And Cheat Sheet
Now for the Exploit
Here you’ll learn to exploit the Heartbleed bug for getting a buggy website’s OpenSSL to spill the contents of its memory and possibly give us the user’s credentials and other information:
Step 1: This should be the good time to update Metasploit to get the new auxiliary module for Heartbleed. (Unless you downloaded Metasploit after the exploit was released).
Type: kali > msfupdate
Metasploit will then go through the long and slow process of checking and updating its modules and framework. The update has completed and we’re ready to begin, by returning to the command prompt.
Step 2: Start Metasploit
kali > msfconsole
Step 3: Find Heartbleed using the built-in search feature.
Type: search heartbleed
This should bring up two auxiliary modules for Heartbleed. We want the one under ‘scanner’ folder and not ‘server’.
Step 4: Load up the auxiliary module
This will load the heartbleed module.
Whenever using a new module, you may wish to find more about it and the options we can set for it.
msf > info
This command reveals the options that we can set to use this module and a description of the module.
Step 5: Set RHOSTS. RHOSTS refers to the website that is vulnerable to the Heartbleed bug. We can set it to the IP address of the website as shown below (To find the IP address of a website, simply ping it through the command line (e.g : ping www.google.com) :
msf > set RHOSTS 192.168.1.169
msf > set verbose true
Finally, set the option “verbose” to “true”. This will give us verbose output (i.e., everything that Metasploit receives from the server will be shown to us).
Step 6: Let her rip.
msf > run
If everything went as planned the server will leak about 64K bytes of what was in its memory. This could contain anything from username-password pairs to credit card numbers which is why this hack (along with pretty much all others) is very much illegal to actually try on a live website without the developer’s explicit consent.
Here is an interesting page listing the names of thousands of vulnerable websites: https://zmap.io/heartbleed/
Also Read: Disable Antivirus In Remote PC
Note:– This guide is only for knowledge purpose and shouldn’t be used for any illegal activities as we are not responsible for anything happens with this.
Hope HACKAGON have provided a healthy knowledge about Heartbleed Bug. So, stay secure and keep learning. If you like this article then don’t forget to share it with your friends and always feel free to drop a comment below, if you have any query or feedback.