PHP 5.6.x < 5.6.39 Multiple vulnerabilities - Nessus
High Plugin ID: 119764This page contains detailed information about the PHP 5.6.x < 5.6.39 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: 119764
Name: PHP 5.6.x < 5.6.39 Multiple vulnerabilities
Filename: php_5_6_39.nasl
Vulnerability Published: 2018-11-14
This Plugin Published: 2018-12-19
Last Modification Time: 2022-04-11
Plugin Version: 1.10
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-19935, 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 5.6.x prior to 5.6.39. 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 denial of service (DoS) vulnerability exists in ext/imap/php_imap.c. An unauthenticated, remote attacker can exploit this issue, via an empty string in the message argument to the imap_mail function, to cause the application to stop responding. (CVE-2018-19935)
- 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 5.6.39 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 5.6.x < 5.6.39 Multiple vulnerabilities vulnerability:
- Metasploit: exploit/linux/http/php_imap_open_rce
[php imap_open Remote Code Execution] - Exploit-DB: exploits/linux/remote/45914.rb
[EDB-45914: PHP imap_open - Remote Code Execution (Metasploit)] - GitHub: https://github.com/HacTF/poc--exp
[CVE-2018-19518] - GitHub: https://github.com/SexyBeast233/SecBooks
[CVE-2018-19518] - GitHub: https://github.com/jiangsir404/POC-S
[CVE-2018-19518] - GitHub: https://github.com/wateroot/poc-exp
[CVE-2018-19518] - GitHub: https://github.com/wrlu/Vulnerabilities
[CVE-2018-19518] - 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 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_5_6_39.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(119764);
script_version("1.10");
script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");
script_cve_id("CVE-2018-19518", "CVE-2018-19935", "CVE-2018-20783");
script_bugtraq_id(106018, 106143, 107121);
script_name(english:"PHP 5.6.x < 5.6.39 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 5.6.x prior to 5.6.39. 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 denial of service (DoS) vulnerability exists in
ext/imap/php_imap.c. An unauthenticated, remote attacker can
exploit this issue, via an empty string in the message argument
to the imap_mail function, to cause the application to stop
responding. (CVE-2018-19935)
- 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-5.php#5.6.39");
script_set_attribute(attribute:"solution", value:
"Upgrade to PHP version 5.6.39 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 =~ "^5(\.6)?$") audit(AUDIT_VER_NOT_GRANULAR, "PHP", port, version);
if (version !~ "^5\.6\.") audit(AUDIT_NOT_DETECT, "PHP version 5.6.x", port);
fix = "5.6.39";
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_5_6_39.nasl
- Windows:
C:\ProgramData\Tenable\Nessus\nessus\plugins\php_5_6_39.nasl
- Mac OS X:
/Library/Nessus/run/lib/nessus/plugins/php_5_6_39.nasl
Go back to menu.
How to Run
Here is how to run the PHP 5.6.x < 5.6.39 Multiple vulnerabilities as a standalone plugin via the Nessus web user interface (https://localhost:8834/):
- Click to start a New Scan.
- Select Advanced Scan.
- Navigate to the Plugins tab.
- On the top right corner click to Disable All plugins.
- On the left side table select CGI abuses plugin family.
- On the right side table select PHP 5.6.x < 5.6.39 Multiple vulnerabilities plugin ID 119764.
- Specify the target on the Settings tab and click to Save the scan.
- 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_5_6_39.nasl -t <IP/HOST>
Run the plugin with audit trail message on the console:
/opt/nessus/bin/nasl -a php_5_6_39.nasl -t <IP/HOST>
Run the plugin with trace script execution written to the console (useful for debugging):
/opt/nessus/bin/nasl -T - php_5_6_39.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_5_6_39.nasl -t <IP/HOST>
Go back to menu.
References
BID | SecurityFocus Bugtraq ID: See also:
- https://www.tenable.com/plugins/nessus/119764
- http://php.net/ChangeLog-5.php#5.6.39
- https://vulners.com/nessus/PHP_5_6_39.NASL
- 145814 - CentOS 8 : php:7.2 (CESA-2020:1624)
- 122821 - PHP 7.0.x < 7.0.33 Multiple vulnerabilities
- 119765 - PHP 7.1.x < 7.1.25 Multiple vulnerabilities
- 121510 - PHP 7.1.x < 7.1.26 Multiple vulnerabilities.
- 119766 - PHP 7.2.x < 7.2.13 Multiple vulnerabilities
- 121353 - PHP 7.2.x < 7.2.14 Multiple vulnerabilities.
- 111217 - PHP 7.3.0 [alpha
- 136057 - RHEL 8 : php:7.2 (RHSA-2020:1624)
Version
This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file php_5_6_39.nasl version 1.10. For more plugins, visit the Nessus Plugin Library.
Go back to menu.