Apache Log4j 1.x Multiple Vulnerabilities - Nessus

High   Plugin ID: 156860

This page contains detailed information about the Apache Log4j 1.x Multiple Vulnerabilities Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 156860
Name: Apache Log4j 1.x Multiple Vulnerabilities
Filename: apache_log4j_1_x_multiple_vulnerabilities.nasl
Vulnerability Published: 2019-12-20
This Plugin Published: 2022-01-19
Last Modification Time: 2022-04-26
Plugin Version: 1.5
Plugin Type: local
Plugin Family: Misc.
Dependencies: apache_log4j_nix_installed.nbin, apache_log4j_win_installed.nbin
Required KB Items [?]: installed_sw/Apache Log4j

Vulnerability Information


Severity: High
Vulnerability Published: 2019-12-20
Patch Published: N/A
CVE [?]: CVE-2019-17571, CVE-2020-9488, CVE-2022-23302, CVE-2022-23305, CVE-2022-23307
CPE [?]: cpe:/a:apache:log4j

Synopsis

A logging library running on the remote host has multiple vulnerabilities.

Description

According to its self-reported version number, the installation of Apache Log4j on the remote host is 1.x and is no longer supported. Log4j reached its end of life prior to 2016. Additionally, Log4j 1.x is affected by multiple vulnerabilities, including :

- Log4j includes a SocketServer that accepts serialized log events and deserializes them without verifying whether the objects are allowed or not. This can provide an attack vector that can be exploited. (CVE-2019-17571)

- Improper validation of certificate with host mismatch in Apache Log4j SMTP appender. This could allow an SMTPS connection to be intercepted by a man-in-the-middle attack which could leak any log messages sent through that appender. (CVE-2020-9488)

- JMSSink uses JNDI in an unprotected manner allowing any application using the JMSSink to be vulnerable if it is configured to reference an untrusted site or if the site referenced can be accesseed by the attacker. (CVE-2022-23302)

Lack of support implies that no new security patches for the product will be released by the vendor. As a result, it is likely to contain security vulnerabilities.

Solution

Upgrade to a version of Apache Log4j that is currently supported.

Upgrading to the latest versions for Apache Log4j is highly recommended as intermediate versions / patches have known high severity vulnerabilities and the vendor is updating their advisories often as new research and knowledge about the impact of Log4j is discovered. Refer to https://logging.apache.org/log4j/2.x/security.html for the latest versions.

Public Exploits


Target Network Port(s): N/A
Target Asset(s): N/A
Exploit Available: True (GitHub)
Exploit Ease: Exploits (PoCs) are available

Here's the list of publicly known exploits and PoCs for verifying the Apache Log4j 1.x Multiple Vulnerabilities vulnerability:

  1. GitHub: https://github.com/Al1ex/CVE-2019-17571
    [CVE-2019-17571: Environment for CVE_2019_17571]
  2. GitHub: https://github.com/Al1ex/CVE_2019_17571
    [CVE-2019-17571: Environment for CVE_2019_17571]
  3. GitHub: https://github.com/AlAIAL90/CVE-2019-17571
    [CVE-2019-17571: PoC for exploiting CVE-2019-17571 : Included in Log4j 1.2 is a SocketServer class ...]
  4. GitHub: https://github.com/GrrrDog/Java-Deserialization-Cheat-Sheet
    [CVE-2019-17571]
  5. GitHub: https://github.com/HackJava/Log4j2
    [CVE-2019-17571]
  6. GitHub: https://github.com/PwnCast/CVE-2019-17571
    [CVE-2019-17571: PoC for exploiting CVE-2019-17571 : Included in Log4j 1.2 is a SocketServer class ...]
  7. GitHub: https://github.com/Retr0-ll/littleterm
    [CVE-2019-17571]
  8. GitHub: https://github.com/SexyBeast233/SecBooks
    [CVE-2019-17571]
  9. GitHub: https://github.com/apache/logging-log4j1
    [CVE-2019-17571]
  10. GitHub: https://github.com/cenote/jasperstarter
    [CVE-2019-17571]
  11. GitHub: https://github.com/danfickle/openhtmltopdf
    [CVE-2019-17571]
  12. GitHub: https://github.com/davejwilson/azure-spark-pools-log4j
    [CVE-2019-17571]
  13. GitHub: https://github.com/fat-tire/floreantpos
    [CVE-2019-17571]
  14. GitHub: https://github.com/janimakinen/hello-world-apache-wicket
    [CVE-2019-17571]
  15. GitHub: https://github.com/jaspervanderhoek/MicroflowScheduledEventManager
    [CVE-2019-17571]
  16. GitHub: https://github.com/logpresso/CVE-2021-44228-Scanner
    [CVE-2019-17571]
  17. GitHub: https://github.com/ltslog/ltslog
    [CVE-2019-17571]
  18. GitHub: https://github.com/marklogic/marklogic-contentpump
    [CVE-2019-17571]
  19. GitHub: https://github.com/thl-cmk/CVE-log4j-check_mk-plugin
    [CVE-2019-17571]
  20. GitHub: https://github.com/woods-sega/woodswiki
    [CVE-2019-17571]
  21. GitHub: https://github.com/yahoo/cubed
    [CVE-2019-17571]
  22. GitHub: https://github.com/HynekPetrak/log4shell-finder
    [CVE-2020-9488]
  23. GitHub: https://github.com/apache/logging-log4j1
    [CVE-2020-9488]
  24. GitHub: https://github.com/davejwilson/azure-spark-pools-log4j
    [CVE-2020-9488]
  25. GitHub: https://github.com/jaspervanderhoek/MicroflowScheduledEventManager
    [CVE-2020-9488]
  26. GitHub: https://github.com/logpresso/CVE-2021-44228-Scanner
    [CVE-2020-9488]
  27. GitHub: https://github.com/ltslog/ltslog
    [CVE-2020-9488]
  28. GitHub: https://github.com/thl-cmk/CVE-log4j-check_mk-plugin
    [CVE-2020-9488]
  29. GitHub: https://github.com/whitesource/log4j-detect-distribution
    [CVE-2020-9488]
  30. GitHub: https://github.com/AlphabugX/CVE-2022-23302
    [CVE-2022-23302: ![image](https://user-images.githubusercontent.com/27001865/150348452-38595c7d-8f16-4 ...]
  31. GitHub: https://github.com/HynekPetrak/log4shell-finder
    [CVE-2022-23302]
  32. GitHub: https://github.com/apache/logging-log4j1
    [CVE-2022-23302]
  33. GitHub: https://github.com/davejwilson/azure-spark-pools-log4j
    [CVE-2022-23302]
  34. GitHub: https://github.com/logpresso/CVE-2021-44228-Scanner
    [CVE-2022-23302]
  35. GitHub: https://github.com/ltslog/ltslog
    [CVE-2022-23302]
  36. GitHub: https://github.com/thl-cmk/CVE-log4j-check_mk-plugin
    [CVE-2022-23302]
  37. GitHub: https://github.com/whitesource/log4j-detect-distribution
    [CVE-2022-23302]
  38. GitHub: https://github.com/AlphabugX/CVE-2022-RCE
    [CVE-2022-23305: Test 反向辣鸡数据投放 CVE-2022-23305 工具 利用 教程 Exploit POC]
  39. GitHub: https://github.com/apache/logging-log4j1
    [CVE-2022-23305]
  40. GitHub: https://github.com/davejwilson/azure-spark-pools-log4j
    [CVE-2022-23305]
  41. GitHub: https://github.com/logpresso/CVE-2021-44228-Scanner
    [CVE-2022-23305]
  42. GitHub: https://github.com/ltslog/ltslog
    [CVE-2022-23305]
  43. GitHub: https://github.com/thl-cmk/CVE-log4j-check_mk-plugin
    [CVE-2022-23305]
  44. GitHub: https://github.com/whitesource/log4j-detect-distribution
    [CVE-2022-23305]
  45. GitHub: https://github.com/AlphabugX/CVE-2022-23307
    [CVE-2022-23307: ![image](https://user-images.githubusercontent.com/27001865/150348452-38595c7d-8f16-4 ...]
  46. GitHub: https://github.com/HynekPetrak/log4shell-finder
    [CVE-2022-23307]
  47. GitHub: https://github.com/apache/logging-log4j1
    [CVE-2022-23307]
  48. GitHub: https://github.com/buluma/ansible-role-cve_2022-23307
    [CVE-2022-23307: Check and report for cve_2022_23307 (log4shell) on your system.]
  49. GitHub: https://github.com/cybersheepdog/Analyst-Tool
    [CVE-2022-23307]
  50. GitHub: https://github.com/davejwilson/azure-spark-pools-log4j
    [CVE-2022-23307]
  51. GitHub: https://github.com/logpresso/CVE-2021-44228-Scanner
    [CVE-2022-23307]
  52. GitHub: https://github.com/ltslog/ltslog
    [CVE-2022-23307]
  53. GitHub: https://github.com/thl-cmk/CVE-log4j-check_mk-plugin
    [CVE-2022-23307]
  54. GitHub: https://github.com/whitesource/log4j-detect-distribution
    [CVE-2022-23307]
  55. GitHub: https://github.com/HynekPetrak/log4shell-finder
    [CVE-2019-17571: Fastest filesystem scanner for log4shell (CVE-2021-44228, CVE-2021-45046) and other ...]
  56. GitHub: https://github.com/Schnitker/log4j-min
    [CVE-2019-17571: Log4j 1.2 project, stripped of the additional appenders and CVEs that cause problems ...]
  57. GitHub: https://github.com/shadow-horse/CVE-2019-17571
    [CVE-2019-17571: Apache Log4j 1.2.X存在反序列化远程代码执行漏洞]
  58. GitHub: https://github.com/Schnitker/log4j-min
    [CVE-2020-9488: Log4j 1.2 project, stripped of the additional appenders and CVEs that cause problems ...]
  59. GitHub: https://github.com/Schnitker/log4j-min
    [CVE-2022-23302: Log4j 1.2 project, stripped of the additional appenders and CVEs that cause problems ...]
  60. GitHub: https://github.com/AlphabugX/CVE-2022-23305
    [CVE-2022-23305: ![image](https://user-images.githubusercontent.com/27001865/150348452-38595c7d-8f16-4 ...]
  61. GitHub: https://github.com/HynekPetrak/log4shell-finder
    [CVE-2022-23305: Fastest filesystem scanner for log4shell (CVE-2021-44228, CVE-2021-45046) and other ...]
  62. GitHub: https://github.com/Schnitker/log4j-min
    [CVE-2022-23305: Log4j 1.2 project, stripped of the additional appenders and CVEs that cause problems ...]
  63. GitHub: https://github.com/Schnitker/log4j-min
    [CVE-2022-23307: Log4j 1.2 project, stripped of the additional appenders and CVEs that cause problems ...]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


CVSS Score Source [?]: CVE-2022-23307
CVSS V2 Vector: AV:N/AC:L/Au:S/C:C/I:C/A:C/E:U/RL:OF/RC:C
CVSS Base Score:9.0 (High)
Impact Subscore:10.0
Exploitability Subscore:8.0
CVSS Temporal Score:6.7 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:6.7 (Medium)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C
CVSS Base Score:8.8 (High)
Impact Subscore:5.9
Exploitability Subscore:2.8
CVSS Temporal Score:7.7 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:7.7 (High)

Go back to menu.

Plugin Source


This is the apache_log4j_1_x_multiple_vulnerabilities.nasl nessus plugin source code. This script is Copyright (C) 2022 and is owned by Tenable, Inc. or an Affiliate thereof.

#%NASL_MIN_LEVEL 70300
##
# (C) Tenable Network Security, Inc.
##

include('deprecated_nasl_level.inc');
include('compat.inc');

if (description)
{
  script_id(156860);
  script_version("1.5");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/26");

  script_cve_id(
    "CVE-2019-17571",
    "CVE-2020-9488",
    "CVE-2022-23302",
    "CVE-2022-23305",
    "CVE-2022-23307"
  );

  script_name(english:"Apache Log4j 1.x Multiple Vulnerabilities");

  script_set_attribute(attribute:"synopsis", value:
"A logging library running on the remote host has multiple vulnerabilities.");
  script_set_attribute(attribute:"description", value:
"According to its self-reported version number, the installation of Apache Log4j on the remote host is 1.x and is no
longer supported. Log4j reached its end of life prior to 2016. Additionally, Log4j 1.x is affected by multiple
vulnerabilities, including :

  - Log4j includes a SocketServer that accepts serialized log events and deserializes them without verifying whether
    the objects are allowed or not. This can provide an attack vector that can be exploited. (CVE-2019-17571)

  - Improper validation of certificate with host mismatch in Apache Log4j SMTP appender. This could allow an SMTPS
    connection to be intercepted by a man-in-the-middle attack which could leak any log messages sent through that
    appender. (CVE-2020-9488)

  - JMSSink uses JNDI in an unprotected manner allowing any application using the JMSSink to be vulnerable if it is
    configured to reference an untrusted site or if the site referenced can be accesseed by the attacker.
    (CVE-2022-23302)

Lack of support implies that no new security patches for the product will be released by the vendor. As a result, it is
likely to contain security vulnerabilities.");
  script_set_attribute(attribute:"see_also", value:"https://logging.apache.org/log4j/1.2/");
  script_set_attribute(attribute:"solution", value:
"Upgrade to a version of Apache Log4j that is currently supported.

Upgrading to the latest versions for Apache Log4j is highly recommended as intermediate 
versions / patches have known high severity vulnerabilities and the vendor is updating 
their advisories often as new research and knowledge about the impact of Log4j is 
discovered. Refer to https://logging.apache.org/log4j/2.x/security.html for the latest 
versions.");
  script_set_attribute(attribute:"agent", value:"all");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:S/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:U/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2022-23307");

  script_set_attribute(attribute:"exploitability_ease", value:"No known exploits are available");

  script_set_attribute(attribute:"vuln_publication_date", value:"2019/12/20");
  script_set_attribute(attribute:"plugin_publication_date", value:"2022/01/19");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:apache:log4j");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"Misc.");

  script_copyright(english:"This script is Copyright (C) 2022 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("apache_log4j_win_installed.nbin", "apache_log4j_nix_installed.nbin");
  script_require_keys("installed_sw/Apache Log4j");

  exit(0);
}

include('vcf.inc');

var app = 'Apache Log4j';
var win_local = FALSE;

if (get_kb_item('SMB/Registry/Enumerated'))
  win_local = TRUE;

var app_info = vcf::get_app_info(app:app, win_local:win_local);

var ver  = app_info['version'];
var path = app_info['path'];
var port = app_info['port'];

if (!port)
  port = 0;

# audit if version >= 2
if (ver_compare(ver:ver, fix:'2.0', strict:FALSE) >= 0)
  vcf::audit(app_info);

var report = strcat(
  '\n  Path              : ', path,
  '\n  Installed version : ', ver,
  '\n');

security_report_v4(severity:SECURITY_HOLE, port:port, extra:report);

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/apache_log4j_1_x_multiple_vulnerabilities.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\apache_log4j_1_x_multiple_vulnerabilities.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/apache_log4j_1_x_multiple_vulnerabilities.nasl

Go back to menu.

How to Run


Here is how to run the Apache Log4j 1.x Multiple Vulnerabilities as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select Misc. plugin family.
  6. On the right side table select Apache Log4j 1.x Multiple Vulnerabilities plugin ID 156860.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl apache_log4j_1_x_multiple_vulnerabilities.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a apache_log4j_1_x_multiple_vulnerabilities.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - apache_log4j_1_x_multiple_vulnerabilities.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state apache_log4j_1_x_multiple_vulnerabilities.nasl -t <IP/HOST>

Go back to menu.

References


See also: Similar and related Nessus plugins:
  • 159914 - Apache APISIX 1.2 <= 1.5 Information Disclosure
  • 160203 - Apache APISIX < 2.10.4 / 2.11.x < 2.12.1 RCE
  • 160299 - Apache APISIX Dashboard < 2.10.1 Authentication Bypass
  • 156103 - Apache Log4j 1.2 JMSAppender Remote Code Execution (CVE-2021-4104)
  • 136424 - Apache Log4j < 2.13.2 Improper Certificate Verification
  • 155999 - Apache Log4j < 2.15.0 Remote Code Execution (Nix)
  • 156057 - Apache Log4j 2.x < 2.16.0 RCE
  • 156183 - Apache Log4j 2.x < 2.17.0 DoS
  • 156327 - Apache Log4j 2.0 < 2.3.2 / 2.4 < 2.12.4 / 2.13 < 2.17.1 RCE
  • 156162 - Apache Log4Shell RCE detection via callback correlation (Direct Check Telnet)
  • 156056 - Apache Log4Shell RCE detection via Raw Socket Logging (Direct Check)
  • 156002 - Apache Log4j < 2.15.0 Remote Code Execution (Windows)
  • 156158 - Apache Log4Shell RCE detection via callback correlation (Direct Check IMAP)
  • 156669 - Apache Log4Shell RCE detection via callback correlation (Direct Check MSRPC)
  • 156197 - Apache Log4Shell RCE detection via callback correlation (Direct Check NetBIOS)
  • 156157 - Apache Log4Shell RCE detection via callback correlation (Direct Check POP3)
  • 156256 - Apache Log4Shell RCE detection via callback correlation (Direct Check SNMP)
  • 156166 - Apache Log4Shell RCE detection via callback correlation (Direct Check SSH)
  • 156375 - Apache Log4Shell RCE detection via callback correlation (Direct Check UPnP)
  • 159764 - Apache Shiro < 1.2.5 Default Cipher Key (CVE-2016-4437)
  • 122487 - Apache Storm < 1.1.3 / 1.2.x < 1.2.2 arbitrary file write vulnerability
  • 125634 - Apache ZooKeeper 3.4.0 < 3.4.10 / 3.5.x < 3.5.3 Multiple Vulnerabilities

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file apache_log4j_1_x_multiple_vulnerabilities.nasl version 1.5. For more plugins, visit the Nessus Plugin Library.

Go back to menu.