蒸米大神谈ROPwww.vuln.cn/6645

     ROP的全称为Return-oriented programming(返回导向编程),这是一种高级的内存攻击技术可以用来绕过现代操作系统的各种通用防御(比如内存不可执行和代码签名等)。

0x01 linux_64与linux_86的区别

    linux_64与linux_86的区别主要有两点:首先是内存地址的范围由32位变成了64位。但是可以使用的内存地址不能大于0x00007fffffffffff,否则会抛出异常。其次是函数参数的传递方式发生了改变,x86中参数都是保存在栈上,但在x64中的前六个参数依次保存在RDI, RSI, RDX, RCX, R8和 R9中,如果还有更多的参数的话才会保存在栈上。

0x02 寻找gadgets

    linux安装 ROPgadget 

git clone https://github.com/JonathanSalwan/ROPgadget.git
cd ROPgadget
sudo python setup.py install

 

    使用ROPgadget

~$ ROPgadget --binary level4 --only "pop|ret"

Gadgets information
============================================================
0x00000000004008ac : pop r12 ; pop r13 ; pop r14 ; pop r15 ; ret
0x00000000004008ae : pop r13 ; pop r14 ; pop r15 ; ret
0x00000000004008b0 : pop r14 ; pop r15 ; ret
0x00000000004008b2 : pop r15 ; ret
0x00000000004008ab : pop rbp ; pop r12 ; pop r13 ; pop r14 ; pop r15 ; ret
0x00000000004008af : pop rbp ; pop r14 ; pop r15 ; ret
0x0000000000400700 : pop rbp ; ret
0x00000000004008b3 : pop rdi ; ret
0x00000000004008b1 : pop rsi ; pop r15 ; ret
0x00000000004008ad : pop rsp ; pop r13 ; pop r14 ; pop r15 ; ret
0x0000000000400601 : ret
0x0000000000400682 : ret 0x2009

 

相关文章:

  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2021-05-16
  • 2021-11-28
  • 2021-07-08
  • 2021-06-04
  • 2021-08-20
猜你喜欢
  • 2021-09-09
  • 2022-01-22
  • 2021-09-26
  • 2021-09-10
  • 2022-01-10
  • 2021-11-25
相关资源
相似解决方案