The Apache Software Foundation has released a security update for its widely used Log4j logging library, addressing a moderate-severity vulnerability that could allow attackers to intercept sensitive log data in transit. Tracked as CVE-2025-68161, the flaw affects the “Socket Appender” component, effectively breaking the TLS hostname verification process even when administrators explicitly enable it.
The vulnerability lies in how Apache Log4j Core handles secure connections when sending logs to a remote server. Typically, when a client connects to a server over TLS (Transport Layer Security), it verifies two things: that the server has a valid certificate, and that the certificate actually belongs to the hostname being contacted.
However, in versions 2.0-beta9 through 2.25.2, the Socket Appender skips step two.
According to the advisory, the software “does not perform TLS hostname verification of the peer certificate,” creating a security blind spot . Crucially, this failure occurs even if the administrator has diligently set the verifyHostName configuration attribute or the log4j2.sslVerifyHostName system property to true. The software essentially ignores the instruction to check the ID card, accepting connections based solely on the trusted issuer stamp.
This oversight opens the door for a classic Man-in-the-Middle (MitM) attack. If an attacker can position themselves between the application and the log server—for example, on a compromised Wi-Fi network or a hijacked router—they could intercept or redirect the log traffic.
To pull this off, the attacker needs to clear two hurdles:
- Interception: They must be able to reroute the network traffic.
- Impersonation: They must present a valid server certificate issued by a Certificate Authority (CA) that the victim’s Java environment trusts.
If successful, the attacker could siphon off logs—which often contain debugging info, user activities, or system errors—without the application raising an alarm.
The issue has been fully resolved in Apache Log4j Core version 2.25.3, and users are advised to upgrade immediately.
For organizations unable to deploy the patch right away, a workaround exists: administrators can configure the Socket Appender to use a “private or restricted trust root”. By limiting the list of trusted certificates to only the specific log server’s certificate (rather than the default global list of trusted CAs), the risk of an attacker presenting a “valid” decoy certificate is significantly reduced.