Palo Alto Networks PAN-OS Management Interface RCE (PAN-SA-2017-0027) - Nessus

Critical   Plugin ID: 105376

This page contains detailed information about the Palo Alto Networks PAN-OS Management Interface RCE (PAN-SA-2017-0027) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 105376
Name: Palo Alto Networks PAN-OS Management Interface RCE (PAN-SA-2017-0027)
Filename: palo_alto_PAN-SA-2017-0027_remote.nasl
Vulnerability Published: 2017-12-05
This Plugin Published: 2017-12-20
Last Modification Time: 2019-11-12
Plugin Version: 1.7
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: palo_alto_webui_detect.nbin
Required KB Items [?]: www/palo_alto_panos

Vulnerability Information


Severity: Critical
Vulnerability Published: 2017-12-05
Patch Published: 2017-12-05
CVE [?]: CVE-2017-15944
CPE [?]: cpe:/o:paloaltonetworks:pan-os

Synopsis

The remote PAN-OS host is affected by a remote code execution vulnerability.

Description

The Palo Alto Networks PAN-OS running on the remote host is affected by a remote code execution vulnerability in the management interface due to improper validation of user-supplied input when handling HTTP requests. An unauthenticated, remote attacker can exploit this, via a series of specially crafted requests, to cause remote code execution in the context of the highest privileged user.

Note that PAN-OS is reportedly affected by other vulnerabilities as well; however, Nessus has not tested for these.

Solution

Upgrade to Palo Alto Networks PAN-OS version 6.1.19 / 7.0.19 / 7.1.14 / 8.0.6 or later

Public Exploits


Target Network Port(s): 443
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 Palo Alto Networks PAN-OS Management Interface RCE (PAN-SA-2017-0027) vulnerability:

  1. Metasploit: exploit/linux/http/panos_readsessionvars
    [Palo Alto Networks readSessionVarsFromFile() Session Corruption]
  2. Exploit-DB: exploits/hardware/remote/43342.txt
    [EDB-43342: Palo Alto Networks Firewalls - Root Remote Code Execution]
  3. Exploit-DB: exploits/unix/remote/44597.rb
    [EDB-44597: Palo Alto Networks - 'readSessionVarsFromFile()' Session Corruption (Metasploit)]
  4. GitHub: https://d0n9.github.io/2018/01/26/CVE-2017-15944%20Palo%20Alto防火墙远程代码执行构造%20EXP/
    [CVE-2017-15944]
  5. GitHub: https://github.com/yukar1z0e/CVE-2017-15944
    [CVE-2017-15944]
  6. GitHub: https://github.com/surajraghuvanshi/PaloAltoRceDetectionAndExploit
    [CVE-2017-15944: Detecion for the vulnerability CVE-2017-15944]
  7. GitHub: https://github.com/xxnbyy/CVE-2017-15944-POC
    [CVE-2017-15944: CVE-2017-15944 Palo Alto Networks firewalls remote root code execution POC]

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-2017-15944
CVSS V2 Vector: AV:N/AC:L/Au:N/C:P/I:P/A:P/E:F/RL:OF/RC:C
CVSS Base Score:7.5 (High)
Impact Subscore:6.4
Exploitability Subscore:10.0
CVSS Temporal Score:6.2 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:6.2 (Medium)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C
CVSS Base Score:9.8 (Critical)
Impact Subscore:5.9
Exploitability Subscore:3.9
CVSS Temporal Score:9.1 (Critical)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:9.1 (Critical)

Go back to menu.

Plugin Source


This is the palo_alto_PAN-SA-2017-0027_remote.nasl nessus plugin source code. This script is Copyright (C) 2017-2019 and is owned by Tenable, Inc. or an Affiliate thereof.

#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(105376);
  script_version("1.7");
  script_cvs_date("Date: 2019/11/12");

  script_cve_id("CVE-2017-15944");
  script_bugtraq_id(102079);

  script_name(english:"Palo Alto Networks PAN-OS Management Interface RCE (PAN-SA-2017-0027)");
  script_summary(english:"Checks the PAN-OS response.");

  script_set_attribute(attribute:"synopsis", value:
"The remote PAN-OS host is affected by a remote code execution vulnerability.");
  script_set_attribute(attribute:"description", value:
"The Palo Alto Networks PAN-OS running on the remote host is affected
by a remote code execution vulnerability in the management interface
due to improper validation of user-supplied input when handling HTTP 
requests. An unauthenticated, remote attacker can exploit this, via
a series of specially crafted requests, to cause remote code
execution in the context of the highest privileged user. 

Note that PAN-OS is reportedly affected by other vulnerabilities as
well; however, Nessus has not tested for these.");
  script_set_attribute(attribute:"see_also", value:"https://securityadvisories.paloaltonetworks.com/Home/Detail/102");
  # https://packetstormsecurity.com/files/145396/Palo-Alto-Networks-Firewalls-Remote-Root-Code-Execution.html
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?d516b278");
  script_set_attribute(attribute:"solution", value:
"Upgrade to Palo Alto Networks PAN-OS version 6.1.19 / 7.0.19 / 7.1.14
/ 8.0.6 or later");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/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-2017-15944");

  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:'Palo Alto Networks readSessionVarsFromFile() Session Corruption');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2017/12/05");
  script_set_attribute(attribute:"patch_publication_date", value:"2017/12/05");
  script_set_attribute(attribute:"plugin_publication_date", value:"2017/12/20");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:paloaltonetworks:pan-os");
  script_end_attributes();

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

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

  script_dependencies("palo_alto_webui_detect.nbin");
  script_require_keys("www/palo_alto_panos");
  script_require_ports("Services/www", 443);

  exit(0);
}

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

app = 'palo_alto_panos';

# Exit if PAN-OS is not detected on the target host
get_install_count(app_name:app, exit_if_zero:TRUE);

port = get_http_port(default:443, embedded:TRUE);

# Exit if PAN-OS is not detected on this port
install = get_single_install(app_name:app, port: port);

# The 'device' parameter contains an invalid char for
# the patched cms_changeDeviceContext.php.
# So the patched php script will return a different response
# than the vulnerable one.
#
# This 'device' parameter specifically causes the vulnerable server
# to return 'Invalid device location string'.
url = '/esp/cms_changeDeviceContext.esp?device=8@foo:';
res = http_send_recv3(
  method:'GET',
  item:url,
  port:port,
  exit_on_fail:TRUE
);

if(empty_or_null(res[2]))
{
  audit(AUDIT_RESP_BAD, port, "a 'cms_changeDeviceContext' request:" + ' No data in the HTTP response body.');
}

# Patched
# Validation in cms_changeDeviceContext.php fails the 'device' string.
# panmodule.so!panUserSetDeviceLocation() is not called.
# So empty string btw the second and third @s.
if('@start@@end@' >< res[2])
{
  audit(AUDIT_WEB_APP_NOT_AFFECTED, 'Palo Alto PAN-OS', build_url(qs:install['path'], port:port));
}
# Vulnerable
# cms_changeDeviceContext.php does not check the 'device' string.
# panmodule.so!panUserSetDeviceLocation() is called.
# panUserSetDeviceLocation() returns "Invalid device location string"
# So the vulnerable server would respond something like:
#
# @start@Invalid device location string: 8@foo:
# @end@
else if('Invalid device location string' >< res[2])
{
  extra = 'Nessus was able to detect the issue with the following request :\n\n' + http_last_sent_request();

  security_report_v4(
    port       : port,
    severity   : SECURITY_HOLE,
    extra      : extra
  );
}
# Unexpected response
else
{
  audit(AUDIT_RESP_BAD, port, "a 'cms_changeDeviceContext' request." + ' Unexpected HTTP response body:\n' + res[2]);
}

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

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/palo_alto_PAN-SA-2017-0027_remote.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\palo_alto_PAN-SA-2017-0027_remote.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/palo_alto_PAN-SA-2017-0027_remote.nasl

Go back to menu.

How to Run


Here is how to run the Palo Alto Networks PAN-OS Management Interface RCE (PAN-SA-2017-0027) 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 Palo Alto Networks PAN-OS Management Interface RCE (PAN-SA-2017-0027) plugin ID 105376.
  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 palo_alto_PAN-SA-2017-0027_remote.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a palo_alto_PAN-SA-2017-0027_remote.nasl -t <IP/HOST>

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

/opt/nessus/bin/nasl -T - palo_alto_PAN-SA-2017-0027_remote.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 palo_alto_PAN-SA-2017-0027_remote.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 105295 - Palo Alto Networks PAN-OS 6.1.x < 6.1.19 Multiple Vulnerabilities
  • 105296 - Palo Alto Networks PAN-OS 7.0.x < 7.0.19 Multiple Vulnerabilities
  • 105298 - Palo Alto Networks PAN-OS 7.1.x < 7.1.14 Multiple Vulnerabilities
  • 104811 - Palo Alto Networks PAN-OS 8.0.x < 8.0.6 Multiple Vulnerabilities
  • 138072 - Palo Alto Networks PAN-OS 7.1.x < 7.1.26 / 8.0.x < 8.1.13 / 8.1.x < 8.1.13 / 9.0.x < 9.0.6 Vulnerability
  • 137880 - Palo Alto Networks PAN-OS 8.0.x < 8.1.15 / 8.1.x < 8.1.15 / 9.0.x < 9.0.9 / 9.1.x < 9.1.3 Authentication Bypass in SAML Authentication (CVE-2020-2021)
  • 138331 - Palo Alto Networks PAN-OS 7.1.x < 8.1.15 / 9.0.x < 9.0.9 / 9.1.x < 9.1.3 GlobalProtect Command Injection Vulnerability
  • 152523 - Palo Alto Networks PAN-OS 8.1.x < 8.1.19 / 9.0.x < 9.0.14 / 9.1.x < 9.1.10 Vulnerability
  • 152505 - Palo Alto Networks PAN-OS 8.1.x < 8.1.19 / 9.0.x < 9.0.14 / 9.1.x < 9.1.9 / 10.0.x < 10.0.5 Vulnerability
  • 152507 - Palo Alto Networks PAN-OS 8.1.x < 8.1.19 / 9.0.x < 9.0.14 / 9.1.x < 9.1.10 / 10.0.x < 10.0.4 Vulnerability
  • 152506 - Palo Alto Networks PAN-OS 9.0.x < 9.0.14 / 9.1.x < 9.1.9 / 10.0.x < 10.0.5 Vulnerability
  • 153213 - Palo Alto Networks PAN-OS 9.0.10 < 9.0.15 / 9.1.4 < 9.1.11 / 10.0.x < 10.0.8 / 10.1.x < 10.1.2 OS Command Injection
  • 155307 - Palo Alto Networks PAN-OS 8.1.x < 8.1.17 Memory Corruption
  • 159362 - Palo Alto Networks PAN-OS 8.1.x < 8.1.23 / 9.0.x < 9.0.16-hf / 9.1.x < 9.1.13-hf / 10.0.x < 10.0.10 / 10.1.x < 10.1.5-hf / 10.2.x < 10.2.1 Vulnerability
  • 157876 - Palo Alto Networks PAN-OS for Panorama < 9.0.15 / 9.1.12-h3 / 10.0.8-h8 Multiple RCE (Log4Shell)
  • 72829 - Palo Alto Networks PAN-OS 5.x < 5.0.9 Multiple Vulnerabilities
  • 100419 - Palo Alto Networks PAN-OS 6.1.x < 6.1.17 / 7.0.x < 7.0.15 / 7.1.x < 7.1.10 / 8.0.x < 8.0.2 Multiple Vulnerabilities
  • 101164 - Palo Alto Networks PAN-OS 6.1.x < 6.1.18 / 7.0.x < 7.0.17 / 7.1.x < 7.1.12 / 8.0.x < 8.0.3 Multiple Vulnerabilities
  • 72827 - Palo Alto Networks PAN-OS < 4.1.13 / 5.0.x < 5.0.6 XSS
  • 78586 - Palo Alto Networks PAN-OS < 5.0.14 / 5.1.x < 5.1.9 / 6.0.x < 6.0.4 OpenSSL MitM
  • 78587 - Palo Alto Networks PAN-OS < 5.0.15 / 5.1.x < 5.1.10 / 6.0.x < 6.0.6 / 6.1.x < 6.1.1 Bash Shell Remote Code Execution (Shellshock)
  • 81167 - Palo Alto Networks PAN-OS <= 5.0.15 / 6.0.x <= 6.0.8 / 6.1.x <= 6.1.2 GNU C Library (glibc) Buffer Overflow (GHOST)
  • 122259 - Palo Alto Networks PAN-OS 6.1.x < 6.1.22 / 7.1.x < 7.1.20 / 8.0.x < 8.0.13 / 8.1.x < 8.1.5 Multiple Vulnerabilities (PAN-SA-2018-0012)
  • 123512 - Palo Alto Networks PAN-OS 6.1.x <= 6.1.20 / 7.1.x < 7.1.21 / 8.0.x < 8.0.14 / 8.1.x < 8.1.4 Multiple Vulnerabilities (PAN-SA-2018-0015)
  • 123079 - Palo Alto Networks < 7.1.23 / 8.0.x < 8.0.16 / 8.1.x < 8.1.7 Integer Overflow Vulnerability (PAN-SA-2019-0006)
  • 129302 - Palo Alto Networks PAN-OS 7.1.x < 7.1.24 / 8.0.x < 8.0.19 / 8.1.x < 8.1.8-h5 / 9.0.x < 9.0.2-h4 Multiple Vulnerabilities
  • 126787 - Palo Alto Networks PAN-OS 7.1.x < 7.1.19 / 8.0.x < 8.0.12 / 8.1.x < 8.1.3 Vulnerability
  • 134305 - Palo Alto Networks PAN-OS 7.1 < 7.1.25 / 8.0 < 8.0.20 / 8.1 < 8.1.8 / 9.0 < 9.0.2 OpenSSL Vulnerability
  • 148123 - Palo Alto Networks PAN-OS 7.1.x < 7.1.26 / 8.0.x < 8.0.21 / 8.1.x < 8.1.13 / 9.0.x < 9.0.7 Multiple Vulnerabilities
  • 138037 - Palo Alto Networks PAN-OS 7.1.x < 7.1.26 / 8.0.x < 8.1.13 / 8.1.x < 8.1.13 / 9.0.x < 9.0.1 Vulnerability
  • 136826 - Palo Alto Networks PAN-OS 7.1.x < 8.1.14 / 8.0.x < 8.1.14 / 8.1.x < 8.1.14 / 9.0.x < 9.0.7 Vulnerability

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file palo_alto_PAN-SA-2017-0027_remote.nasl version 1.7. For more plugins, visit the Nessus Plugin Library.

Go back to menu.