Critical Hostname Verification Bypass in Apache HttpClient 4.3.x

httpcomponents-client Updated 02 Oct 2025

Summary

30/10/2017
N/A
Yes i
Critical
9.8

CVE-2013-4366: http/impl/client/HttpClientBuilder.java in Apache HttpClient 4.3.x before 4.3.1 does not ensure that X509HostnameVerifier is not null, which allows attackers to have unspecified impact via vectors involving hostname veri... Affects httpcomponents-client versions < 4.3.2-1. Fixed in 4.3.2-1. 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 Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Apache HttpClient is a widely used library for making HTTP requests in Java applications. It provides a robust and flexible framework for handling HTTP connections, including support for various authentication schemes, connection management, and cookie handling. However, versions 4.3.x before 4.3.1 are vulnerable to a critical issue where the X509HostnameVerifier is not properly validated, potentially allowing attackers to exploit hostname verification weaknesses.

Vulnerability Detail

The vulnerability identified as CVE-2013-4366 arises from a failure in the HttpClientBuilder.java file of Apache HttpClient 4.3.x prior to version 4.3.1. Specifically, the code does not ensure that the X509HostnameVerifier is not null, which can lead to unspecified impacts through improper hostname verification. This flaw can be exploited by attackers to impersonate legitimate servers, intercept sensitive data, or perform man-in-the-middle attacks, thereby compromising the integrity and confidentiality of the communication.

How To Fix

Minimum fixed version

4.3.2-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade httpcomponents-client

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

Workaround

If an immediate upgrade is not feasible, consider implementing a custom hostname verifier that checks for null values before proceeding with verification. Here is a sample code snippet to illustrate this workaround:

import org.apache.http.conn.ssl.X509HostnameVerifier;

X509HostnameVerifier customVerifier = new X509HostnameVerifier() { @Override public void verify(String host, SSLSocket ssl) throws IOException {

        if (host == null) {
            throw new IOException("Hostname verifier cannot be null");
        }
        // Implement additional verification logic here
    }
    // Implement other required methods
};

Conclusion

CVE-2013-4366 presents a significant security risk for applications using Apache HttpClient 4.3.x prior to version 4.3.1. It is crucial for developers to upgrade to a patched version to protect against potential attacks that exploit hostname verification weaknesses. Utilizing tools like Vulert can help in monitoring and managing vulnerabilities effectively.

See every vulnerability recorded for httpcomponents-client →

Share this vulnerability

FAQ

CVE-2013-4366 is a vulnerability in Apache HttpClient 4.3.x that allows attackers to bypass hostname verification due to a null check on the X509HostnameVerifier.

Exploitation of this vulnerability can lead to man-in-the-middle attacks, where an attacker can intercept and manipulate data between your application and a legitimate server.

Apache HttpClient versions 4.3.x prior to 4.3.1 are affected by this vulnerability.

The recommended action is to upgrade to Apache HttpClient version 4.3.2-1 or later to ensure proper hostname verification.

Yes, 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.

Related vulnerabilities

Recent vulnerabilities recorded for httpcomponents-client.

How To Fix

Minimum fixed version

4.3.2-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade httpcomponents-client

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