PHP 7.1.x < 7.1.25 Multiple vulnerabilities - Nessus

High   Plugin ID: 119765

This page contains detailed information about the PHP 7.1.x < 7.1.25 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: 119765
Name: PHP 7.1.x < 7.1.25 Multiple vulnerabilities
Filename: php_7_1_25.nasl
Vulnerability Published: 2018-11-14
This Plugin Published: 2018-12-19
Last Modification Time: 2022-04-11
Plugin Version: 1.8
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: php_version.nasl
Required KB Items [?]: www/PHP

Vulnerability Information


Severity: High
Vulnerability Published: 2018-11-14
Patch Published: 2018-12-06
CVE [?]: CVE-2018-19518, CVE-2018-20783
CPE [?]: cpe:/a:php:php

Synopsis

An application installed on the remote host is affected by multiple vulnerabilities.

Description

According to its banner, the version of PHP running on the remote web server is 7.1.x prior to 7.1.25. It is, therefore, affected by multiple vulnerabilities:

- An arbitrary command injection vulnerability exists in the imap_open function due to improper filters for mailbox names prior to passing them to rsh or ssh commands. An authenticated, remote attacker can exploit this by sending a specially crafted IMAP server name to cause the execution of arbitrary commands on the target system. (CVE-2018-19518)

- A heap buffer over-read exists in the phar_parse_pharfile function. An unauthenticated, remote attacker can exploit this to read allocated or unallocated memory past the actual data when trying to parse a .phar file. (CVE-2018-20783)

Solution

Upgrade to PHP version 7.1.25 or later.

Public Exploits


Target Network Port(s): 80
Target Asset(s): Services/www
Exploit Available: True (Metasploit Framework, Exploit-DB, GitHub)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the PHP 7.1.x < 7.1.25 Multiple vulnerabilities vulnerability:

  1. Metasploit: exploit/linux/http/php_imap_open_rce
    [php imap_open Remote Code Execution]
  2. Exploit-DB: exploits/linux/remote/45914.rb
    [EDB-45914: PHP imap_open - Remote Code Execution (Metasploit)]
  3. GitHub: https://github.com/HacTF/poc--exp
    [CVE-2018-19518]
  4. GitHub: https://github.com/SexyBeast233/SecBooks
    [CVE-2018-19518]
  5. GitHub: https://github.com/jiangsir404/POC-S
    [CVE-2018-19518]
  6. GitHub: https://github.com/wateroot/poc-exp
    [CVE-2018-19518]
  7. GitHub: https://github.com/wrlu/Vulnerabilities
    [CVE-2018-19518]
  8. GitHub: https://github.com/ensimag-security/CVE-2018-19518
    [CVE-2018-19518: Some works on CVE-2018-19518]

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-2018-19518
CVSS V2 Vector: AV:N/AC:M/Au:S/C:C/I:C/A:C/E:F/RL:OF/RC:C
CVSS Base Score:8.5 (High)
Impact Subscore:10.0
Exploitability Subscore:6.8
CVSS Temporal Score:7.0 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:7.0 (High)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C
CVSS Base Score:7.5 (High)
Impact Subscore:5.9
Exploitability Subscore:1.6
CVSS Temporal Score:7.0 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:7.0 (High)

Go back to menu.

Plugin Source


This is the php_7_1_25.nasl nessus plugin source code. This script is Copyright (C) 2018-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(119765);
  script_version("1.8");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");

  script_cve_id("CVE-2018-19518", "CVE-2018-20783");
  script_bugtraq_id(106018, 107121);

  script_name(english:"PHP 7.1.x < 7.1.25 Multiple vulnerabilities");

  script_set_attribute(attribute:"synopsis", value:
"An application installed on the remote host is affected by
 multiple vulnerabilities.");
  script_set_attribute(attribute:"description", value:
"According to its banner, the version of PHP running on the remote web
server is 7.1.x prior to 7.1.25. It is, therefore, affected by
multiple vulnerabilities:

  - An arbitrary command injection vulnerability exists in the
  imap_open function due to improper filters for mailbox names prior
  to passing them to rsh or ssh commands. An authenticated, remote
  attacker can exploit this by sending a specially crafted IMAP server
  name to cause the execution of arbitrary commands on the target
  system. (CVE-2018-19518)

  - A heap buffer over-read exists in the phar_parse_pharfile function.
  An unauthenticated, remote attacker can exploit this to read
  allocated or unallocated memory past the actual data when trying to
  parse a .phar file. (CVE-2018-20783)");
  script_set_attribute(attribute:"see_also", value:"http://php.net/ChangeLog-7.php#7.1.25");
  script_set_attribute(attribute:"solution", value:
"Upgrade to PHP version 7.1.25 or later.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:M/Au:S/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:F/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2018-19518");

  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'php imap_open Remote Code Execution');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2018/11/14");
  script_set_attribute(attribute:"patch_publication_date", value:"2018/12/06");
  script_set_attribute(attribute:"plugin_publication_date", value:"2018/12/19");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:php:php");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"CGI abuses");

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

  script_dependencies("php_version.nasl");
  script_require_keys("www/PHP");
  script_require_ports("Services/www", 80);

  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("misc_func.inc");
include("http.inc");
include("webapp_func.inc");

port = get_http_port(default:80, php:TRUE);

php = get_php_from_kb(
  port : port,
  exit_on_fail : TRUE
);

version = php["ver"];
source = php["src"];

backported = get_kb_item('www/php/'+port+'/'+version+'/backported');

if (report_paranoia < 2 && backported)
  audit(AUDIT_BACKPORT_SERVICE, port, "PHP "+version+" install");

# Check that it is the correct version of PHP
if (version =~ "^7(\.1)?$") audit(AUDIT_VER_NOT_GRANULAR, "PHP", port, version);
if (version !~ "^7\.1\.") audit(AUDIT_NOT_DETECT, "PHP version 7.1.x", port);

fix = "7.1.25";
if (ver_compare(ver:version, fix:fix, strict:FALSE) < 0)
{
  report =
    '\n  Version source    : ' + source +
    '\n  Installed version : ' + version +
    '\n  Fixed version     : ' + fix +
    '\n';
  security_report_v4(port:port, extra:report, severity:SECURITY_HOLE );
}
else audit(AUDIT_LISTEN_NOT_VULN, "PHP", port, version);

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

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

Go back to menu.

How to Run


Here is how to run the PHP 7.1.x < 7.1.25 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 CGI abuses plugin family.
  6. On the right side table select PHP 7.1.x < 7.1.25 Multiple vulnerabilities plugin ID 119765.
  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 php_7_1_25.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

/opt/nessus/bin/nasl -T - php_7_1_25.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 php_7_1_25.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 121132 - Amazon Linux AMI : php56 / php70,php71,php72 (ALAS-2019-1147)
  • 145814 - CentOS 8 : php:7.2 (CESA-2020:1624)
  • 119695 - Debian DLA-1608-1 : php5 security update
  • 122548 - Debian DLA-1700-1 : uw-imap security update
  • 156391 - Debian DLA-2866-1 : uw-imap - LTS security update
  • 119561 - Debian DSA-4353-1 : php7.0 - security update
  • 123113 - EulerOS 2.0 SP3 : php (EulerOS-SA-2019-1100)
  • 124905 - EulerOS Virtualization for ARM 64 3.0.1.0 : php (EulerOS-SA-2019-1402)
  • 124998 - EulerOS Virtualization 3.0.1.0 : php (EulerOS-SA-2019-1545)
  • 139151 - EulerOS 2.0 SP8 : php (EulerOS-SA-2020-1821)
  • 139998 - EulerOS Virtualization for ARM 64 3.0.6.0 : php (EulerOS-SA-2020-1895)
  • 120566 - Fedora 29 : php (2018-7ebfe1e6f2)
  • 120854 - Fedora 28 : php (2018-dfe1f0bac6)
  • 134965 - GLSA-202003-57 : PHP: Multiple vulnerabilities
  • 119569 - openSUSE Security Update : php5 (openSUSE-2018-1506)
  • 119570 - openSUSE Security Update : php7 (openSUSE-2018-1507)
  • 124263 - openSUSE Security Update : php5 (openSUSE-2019-1256)
  • 124401 - openSUSE Security Update : php7 (openSUSE-2019-1293)
  • 126034 - openSUSE Security Update : php7 (openSUSE-2019-1572)
  • 126035 - openSUSE Security Update : php7 (openSUSE-2019-1573)
  • 119764 - PHP 5.6.x < 5.6.39 Multiple vulnerabilities
  • 122821 - PHP 7.0.x < 7.0.33 Multiple vulnerabilities
  • 119766 - PHP 7.2.x < 7.2.13 Multiple vulnerabilities
  • 111217 - PHP 7.3.0 [alpha
  • 136057 - RHEL 8 : php:7.2 (RHSA-2020:1624)
  • 119455 - SUSE SLES11 Security Update : Recommended update for php53 (SUSE-SU-2018:3986-1)
  • 120176 - SUSE SLES12 Security Update : Recommended update for php7 (SUSE-SU-2018:3988-1)
  • 120177 - SUSE SLES12 Security Update : Recommended update for php5 (SUSE-SU-2018:3995-1)
  • 124190 - SUSE SLES12 Security Update : php5 (SUSE-SU-2019:0985-1)
  • 123826 - SUSE SLES11 Security Update : php53 (SUSE-SU-2019:14013-1)
  • 125850 - SUSE SLED15 / SLES15 Security Update : php7 (SUSE-SU-2019:1461-1)
  • 130149 - Ubuntu 16.04 LTS / 18.04 LTS / 19.04 : UW IMAP vulnerability (USN-4160-1)

Version


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

Go back to menu.