|
|
|
[求助]:《shellcoder's handbook 》第19页测试 shellcode 的程序编译后运行出错!
谢谢scz的解答,的确应该就是scz所说的这个原因了。 在arhat的提示下我到rh9上做了测试,我在rh9下执行那段代码是可以正常运行的,并且按照scz的指导去查看/proc/p-pid/maps 下面各加载页面的执行属性,无法正常执行的系统的栈页属性确实没有x,肯定就是DEP的原因了。 以前刚开始学习shellcode栈溢出的内容时模模糊糊的感觉是有点不对劲的,只是没有把这个概念显化,记得看操作系统的教科书上说,操作系统可以对内存页面设置是否可执行属性的,好像说可执行文件格式之所以分成.data,.text等段的意义正在于此。依照这样看来,shellcode岂不是根本没有多大的用武之地吗? 搜了一下关于DEP的资料,大都是关于WindowsXP新加DEP 补丁的一些设置说明,其中搜到北邮一个高手flyingkisser一篇逆向DEP的文章,里面说绕过DEP还是得用return-to-lib的经典方式返回到VirtualProtect()来改变当前栈的属性。 怎么这些在那些shellcode的书里面都不提到呢,感觉对shellcode的效能大小也有些信心动摇了,呵呵 关于linux下的DEP,好像相关文章很少,没有搜到。不知道scz你是怎样启用linux kernel的DEP的呢?能不能帮忙推荐几篇这方面的文章? 另外就是,怎么kernel对于这种出错有没有在什么地方记录DEP违规?我在/var/log/message里面没看到哦 您建议我装个Debian好了,不知道debian在这方面和rh 有什么区别? 对于DEP(数据段执行保护)这个概念今天第一次有了明确概念,再次感谢scz,感谢大家的关注和帮助。 |
|
[求助]:《shellcoder's handbook 》第19页测试 shellcode 的程序编译后运行出错!
嗯,谢谢提示,我再到redhat 9 下面去试一下。 但是我觉得即使内核版本不同,栈空间里面的顺序应该也不会乱掉啊,并且即使我不直接用main做实验,我用main()调用func(),在func()里面再调用那几个语句也一样会报内存异常错误, 就是说应该并不是main()函数体外面的环境引起的,不管怎样,我先去搭一个redhat9的虚拟机吧:) |
|
[求助]:《shellcoder's handbook 》第19页测试 shellcode 的程序编译后运行出错!
我自己手动调试过的,ebp和esp显示应该正是 ret 之上时 保存的ebp 再之上是自动变量, 调整指针是2,刚好追到ebp下面的那个位置,也就是ret的位置,从书上讲的和我自己亲手调的,都应该没错才对,但是实际运行中确实是内存访问异常了。 我用stepi指令逐汇编指令调试,我注意到leave指令之后,(即ebp恢复之后),将要执行ret之前,再调试输出ret的值,输出的就是恢复之后的ebp下面那一格的值了,刚好是0,我怀疑是此处引起了内存访问异常错误,但是即便在leave指令之后,esp指向的位置也正是所修改的 &ret+2 的位置啊,就是说在执行 ret 之前, shellcode[]的内容确实是在栈顶esp处的,但是一执行ret指令就出错了。十分不解,谢谢关注,期待进一步的帮助解答~ (btw: shellcoder's handbook 那本书网上有中文版,好像论坛里就有,你找找看吧) |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值