CVE-2025-68161: Log4j core Apache Log4j Does Not Verify Vulnerability

MODERATE
Advisory Identifier: GHSA-vc5p-v9hr-52mj
CWE-297
Published
Advisory Summary

CVE-2025-68161 is a MODERATE apache log4j does not verify vulnerability (CWE-297: Improper Validation of Certificate with Host Mismatch) affecting Log4j core libraries in the Maven ecosystem. The issue involves apache log4j does not verify the tls hostname in its socket appender. Remediation is available by upgrading affected packages to version 2.25.3.

CVE-2025-68161 at a Glance

CVE Identifier CVE-2025-68161
GHSA Identifier GHSA-vc5p-v9hr-52mj
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-297: Improper Validation of Certificate with Host Mismatch
Affected Product Log4j core
Package Ecosystem Maven
Published Date
Last Updated

How to Fix CVE-2025-68161

To remediate this vulnerability, upgrade all affected Log4j core dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.apache.logging.log4j:log4j-core fixed: 2.25.3
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.25.3</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.apache.logging.log4j

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2025-68161, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.apache.logging.log4j

Analyze the terminal output to locate any version of Log4j core in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.25.3), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.apache.logging.log4j command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-297: Improper Validation of Certificate with Host Mismatch, where the product communicates with a host that provides a certificate, but the product does not properly ensure that the certificate is actually associated with that host. In Log4j core, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

The Socket Appender in Apache Log4j Core versions 2.0-beta9 through 2.25.2 does not perform TLS hostname verification of the peer certificate, even when the [verifyHostName](https://logging.apache.org/log4j/2.x/manual/appenders/network.html#SslConfiguration-attr-verifyHostName) configuration attribute or the [log4j2.sslVerifyHostName](https://logging.apache.org/log4j/2.x/manual/systemproperties.html#log4j2.sslVerifyHostName) system property is set to true. This issue may allow a man-in-the-middle attacker to intercept or redirect log traffic under the following conditions: * The attacker is able to intercept or redirect network traffic between the client and the log receiver. * The attacker can present a server certificate issued by a certification authority trusted by the Socket Appender’s configured trust store (or by the default Java trust store if no custom trust store is configured). Users are advised to upgrade to Apache Log4j Core version 2.25.3, which addresses this issue. As an alternative mitigation, the Socket Appender may be configured to use a private or restricted trust root to limit the set of trusted certificates.

CVE-2025-68161 Affected Log4j core Versions

1 component(s)
Fixed Versions:
2.25.3
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.logging.log4j:log4j-core
Maven
≥ 2.0-beta9
< 2.25.3
2.25.3

References

Frequently Asked Questions

What is CVE-2025-68161?
CVE-2025-68161 is a security vulnerability in Log4j core involving Apache Log4j does not verify the TLS hostname in its Socket Appender under CWE-297: Improper Validation of Certificate with Host Mismatch.
Which Log4j core versions are affected?
Affected versions include releases prior to 2.25.3 across affected packages: org.apache.logging.log4j:log4j-core.
What version fixes CVE-2025-68161?
Upgrading to 2.25.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is log4j-core affected?
Yes, org.apache.logging.log4j:log4j-core is affected in releases prior to 2.25.3. Upgrade your dependency to 2.25.3 or later.
What CWE is associated with CVE-2025-68161?
CVE-2025-68161 is classified under CWE-297: Improper Validation of Certificate with Host Mismatch (The product communicates with a host that provides a certificate, but the product does not properly ensure that the certificate is actually associated with that host.).
How can I check Maven dependencies for CVE-2025-68161?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.logging.log4j'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vc5p-v9hr-52mj",
  "modified" : "2025-12-19T22:08:02Z",
  "published" : "2025-12-18T21:31:44Z",
  "aliases" : [ "CVE-2025-68161" ],
  "summary" : "Apache Log4j does not verify the TLS hostname in its Socket Appender",
  "details" : "The Socket Appender in Apache Log4j Core versions 2.0-beta9 through 2.25.2 does not perform TLS hostname verification of the peer certificate, even when the  [verifyHostName](https://logging.apache.org/log4j/2.x/manual/appenders/network.html#SslConfiguration-attr-verifyHostName)  configuration attribute or the  [log4j2.sslVerifyHostName](https://logging.apache.org/log4j/2.x/manual/systemproperties.html#log4j2.sslVerifyHostName) system property is set to true.\n\nThis issue may allow a man-in-the-middle attacker to intercept or redirect log traffic under the following conditions:\n\n  *  The attacker is able to intercept or redirect network traffic between the client and the log receiver.\n  *  The attacker can present a server certificate issued by a certification authority trusted by the Socket Appender’s configured trust store (or by the default Java trust store if no custom trust store is configured).\n\n\nUsers are advised to upgrade to Apache Log4j Core version 2.25.3, which addresses this issue.\n\nAs an alternative mitigation, the Socket Appender may be configured to use a private or restricted trust root to limit the set of trusted certificates.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.logging.log4j:log4j-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0-beta9"
      }, {
        "fixed" : "2.25.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-68161"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apache/logging-log4j2/pull/4002"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apache/logging-log4j2/commit/3b93748497e1adbbd027fda8a5e7268ec5d0d578"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apache/logging-log4j2"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread/xr33kyxq3sl67lwb61ggvm1fzc8k7dvx"
  }, {
    "type" : "WEB",
    "url" : "https://logging.apache.org/cyclonedx/vdr.xml"
  }, {
    "type" : "WEB",
    "url" : "https://logging.apache.org/log4j/2.x/manual/appenders/network.html#SslConfiguration-attr-verifyHostName"
  }, {
    "type" : "WEB",
    "url" : "https://logging.apache.org/log4j/2.x/manual/systemproperties.html#log4j2.sslVerifyHostName"
  }, {
    "type" : "WEB",
    "url" : "https://logging.apache.org/security.html#CVE-2025-68161"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2025/12/18/1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-297" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-12-19T22:08:02Z",
    "nvd_published_at" : "2025-12-18T21:15:57Z"
  }
}