Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSAPP Attack lab 有感 #11

Open
wisecsj opened this issue Jan 14, 2019 · 0 comments
Open

CSAPP Attack lab 有感 #11

wisecsj opened this issue Jan 14, 2019 · 0 comments

Comments

@wisecsj
Copy link
Owner

wisecsj commented Jan 14, 2019

了解了利用缓冲区溢出进行攻击的两种方式:1.CI (code injection) 2.ROP(Return-Oriented Programming)

第一种方式比较简单,但在如下场景就不太适用:

1.每次栈的位置是随机的,于是我们没有办法确定需要跳转的地址

2.即使我们能够找到规律注入代码,但是栈是不可执行的,一旦执行,则会遇到段错误

而应该用ROP:
image

因为无法再代码注入,所以想到利用程序自身的代码指令来实现我们想要执行的功能。
而每一个Gadget(小的代码段,后跟ret),合起来,便组成了我们想要的代码片段。

如何获得gadget呢?

譬如我们要实现 popq %rdi:通过指令的编码表得到其二进制表示,然后到反汇编出来的文件里去查找,并且满足后跟c3(ret)。最后记录下此条指令开始的内存地址即可

PS:注意机器是大端序还是小端序

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant