org.apache.logging.log4j:log4j-core@2.16.0 vulnerabilities

  • latest version

    2.25.0

  • latest non vulnerable version

  • first published

    12 years ago

  • latest version published

    20 days 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.

    How to fix?

    Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.

    Fix for free
    VulnerabilityVulnerable Version
    • 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)