Hostname Verification Bypass in Apache HttpComponents HttpClient and HttpAsyncClient

commons-httpclient Updated 02 Oct 2025

Summary

21/08/2014
N/A
Yes i
Unrated
Not published

CVE-2014-3577: org.apache.http.conn.ssl.AbstractVerifier in Apache HttpComponents HttpClient before 4.3.5 and HttpAsyncClient before 4.0.2 does not properly verify that the server hostname matches a domain name in the subject's Common... Affects commons-httpclient versions < 3.1-11. Fixed in 3.1-11. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Apache HttpComponents HttpClient and HttpAsyncClient are widely used libraries in Java for making HTTP requests. They provide a robust framework for handling HTTP connections, including support for SSL/TLS. However, prior to certain versions, these libraries had a critical flaw in hostname verification, which could lead to security vulnerabilities when connecting to SSL servers.

Vulnerability Detail

The vulnerability, identified as CVE-2014-3577, arises from the failure of org.apache.http.conn.ssl.AbstractVerifier in Apache HttpComponents HttpClient (versions before 4.3.5) and HttpAsyncClient (versions before 4.0.2) to properly verify that the server hostname matches a domain name in the subject's Common Name (CN) or subjectAltName field of the X.509 certificate. This oversight allows man-in-the-middle attackers to spoof SSL servers, potentially leading to unauthorized access to sensitive data. An example of this vulnerability is demonstrated by the string 'foo,CN=www.apache.org' in the distinguished name (DN) of a certificate, which could mislead the verification process.

How To Fix

Minimum fixed version

3.1-11

This is the first release that contains the fix.

sudo apt-get install --only-upgrade commons-httpclient

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate upgrading is not feasible, consider implementing a custom hostname verifier that enforces strict hostname verification. This can be done by creating a class that implements the HostnameVerifier interface and overriding the verify method to include your own hostname checks. Here is a sample code snippet:

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;

public class CustomHostnameVerifier implements HostnameVerifier { @Override public boolean verify(String hostname, SSLSession session) {

        // Implement your hostname verification logic here
        return hostname.equals("expected.hostname.com");
    }
}

HttpsURLConnection.setDefaultHostnameVerifier(new CustomHostnameVerifier());

Conclusion

CVE-2014-3577 represents a significant security risk for applications using affected versions of Apache HttpComponents HttpClient and HttpAsyncClient. It is crucial for developers to upgrade to the latest versions to ensure proper hostname verification and protect against potential man-in-the-middle attacks. Additionally, implementing a custom hostname verifier can serve as a temporary mitigation strategy.

See every vulnerability recorded for commons-httpclient →

Share this vulnerability

FAQ

CVE-2014-3577 is a vulnerability in Apache HttpComponents HttpClient and HttpAsyncClient that allows man-in-the-middle attacks due to improper hostname verification.

The vulnerability affects Apache HttpComponents HttpClient versions before 4.3.5 and HttpAsyncClient versions before 4.0.2.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. You can check your application against this vulnerability using the Vulert playground without any signup.

If exploited, this vulnerability can allow attackers to intercept and manipulate sensitive data transmitted over SSL connections, leading to data breaches or unauthorized access.

Yes, you can implement a custom hostname verifier to enforce stricter hostname checks until you can upgrade to the patched versions.

Related vulnerabilities

Recent vulnerabilities recorded for commons-httpclient.

How To Fix

Minimum fixed version

3.1-11

This is the first release that contains the fix.

sudo apt-get install --only-upgrade commons-httpclient

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback