查找kernel32.dll 基地址 stack

本文探讨如何从ESP寄存器获取kernel32.dll中call指令push的返回地址,该地址关联于应用程序的返回点,如rtlexituserthread或exitthread。通过地址对齐方法找到kernel32.dll模块的特定值,并通过递减64k来搜索目标位置。
摘要由CSDN通过智能技术生成

从[esp]获取kernel32中call 指令push的返回地址, 即应用程序返回后的地址

rtlexituserthread , 有些是exitthread. 

拿到这个地址就拿到了kernel32空间的某个值, 模块地址64k对齐,去掉低2个字节来对齐.

然后依次减64k寻找

.386
.model flat, stdcall
option casemap:none

include		windows.inc
include		user32.inc
includelib	user32.lib
include		kernel32.inc
includelib	kernel32.lib
include msvcrt.inc
includelib msvcrt.lib


.data
buffer db 256 dup(0)
kernerl32_module dd 0

.const
szText db 'addr : %08x',0dh,0ah,0

.code

seh_handler proc C pExceptionRecord, pSehStack, pContext, DispatcherContext
	pushad
	assume esi:ptr CONTEXT

	mov esi,pContext
	mov edx,pSehStack
	push [edx+8]
	pop [esi].regEip
	push [edx+0ch]
	pop [esi].regEbp
	push edx
	pop [esi].regEsp
	assume esi:nothing
	
	popad
	mov eax,ExceptionContinueExecution
	ret
seh_handler endp

isPe proc mem:dword
	local ok:dword
	pushad

	mov ok,0
	mov esi,mem
	.if esi == 0
		jmp done
	.endif

	assume esi:ptr
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值