
This is the Heratbleed bug (CVE-2014-0160) documentation I did for Advenced Cyber Attacks course.
This repository features Heartbleed.java, a custom Java-based exploit designed to demonstrate the Heartbleed vulnerability (CVE-2014-0160) by extracting sensitive data from a vulnerable server (IP: 192.168.1.132) running Apache (port 443) and Postfix (port 465). The exploit sends malformed TLS heartbeat requests, leveraging the vulnerability in unpatched OpenSSL versions (1.0.1 to 1.0.1f) to leak up to 64KB of memory per request. Supporting Bash scripts (apache_memload.sh and postfix_memload.sh) flood the services’ memory with sensitive data, such as user credentials, mail server passwords, and SSL certificates, which the Java exploit then extracts.
This project is part of a comprehensive security demonstration documented in a detailed Word document, which outlines the attack methodology, results, and implications for both Apache and Postfix services. The work involved crafting scripts to load memory, executing the exploit from a Windows client (IP: 192.168.1.99) and analyzing the leaked data to highlight the vulnerability’s impact.
Heartbleed.java is the core of this demo, implementing a streamlined attack process:
sendHeartbeats method, which is central to the exploit.The sendHeartbeats method, a key component, orchestrates the attack by repeatedly sending crafted heartbeat messages to the server, exploiting the Heartbleed vulnerability to extract memory contents. This method’s role is detailed in the accompanying Word document, alongside a screenshot of its implementation.
The full scope of this work includes:
apache_memload.sh to flood Apache’s memory with 50 curl requests, embedding sensitive data like SHA-512 password hashes via a PHP script (memload.php). Similarly, postfix_memload.sh sends 50 SMTP payloads to Postfix, embedding email credentials and passwords.Heartbleed.java from a Windows client (IP: 192.168.1.99) to target Apache (port 443) and Postfix (port 465), successfully leaking data such as user credentials, passwords, and certificates.sendHeartbeats method, and a conclusion with future mitigation strategies.memload.php at https://localhost/phpmyadmin/memload.php.sudo apt install openjdk-11-jdk.Clone the Repository:
git clone https://github.com/Shayhha/HeartbleedAttack
Compile the Exploit:
javac -d bin Heartbleed.java
~/Desktop/apache_memload.sh
~/Desktop/postfix_memload.sh
Heartbleed.java to set SERVER_PORT = APACHE_PORT, recompile, then:javac -d bin Heartbleed.java
java -cp bin Heartbleed
Heartbleed.java to set SERVER_PORT = POSTFIX_PORT, recompile, then:javac -d bin Heartbleed.java
java -cp bin Heartbleed
This exploit is for educational purposes only. Do not use it to harm systems without explicit permission. Ensure compliance with legal and ethical standards.
MIT License—see LICENSE for details.