本帖最后由 wwr2128 于 2019-3-8 09:09 编辑
题目要求:在仅使用程序允许输入的情况下获取高权限shell并获取flag。(不允许使用radare2或者其他可更改程序流的软件,可以注入shellcode)
已经尝试的思路:
根据初步观察, 应该不属于格式化字符串的bufferoverflow类问题,且文件里面包含一个已经存在的debug function (000006c4 )(详见底下objdump),不知道如何通过更改对应的值使程序执行流到达debug的function。
曾经想通过格式化字符串运行高权限shell获取flag,但是payload不知道应该如何写。通过IDA看出程序执行会更改一个hashtable:
ida_1.png (69.61 KB, 下载次数: 0)
2019-3-8 08:49 上传
Linux下运行程序:
Annotation.png (35.38 KB, 下载次数: 0)
run
2019-3-8 08:52 上传
objdump:
./be1: file format elf32-i386
Disassembly of section .init:
00000494 <_init>:
494: 53 push %ebx
495: 83 ec 08 sub $0x8,%esp
498: e8 f3 00 00 00 call 590 <__x86.get_pc_thunk.bx>
49d: 81 c3 83 16 00 00 add $0x1683,%ebx
4a3: 8b 83 f4 ff ff ff mov -0xc(%ebx),%eax
4a9: 85 c0 test %eax,%eax
4ab: 74 05 je 4b2 <_init>
4ad: e8 96 00 00 00 call 548 <__gmon_start__>
4b2: 83 c4 08 add $0x8,%esp
4b5: 5b pop %ebx
4b6: c3 ret
Disassembly of section .plt:
000004c0 <.plt>:
4c0: ff b3 04 00 00 00 pushl 0x4(%ebx)
4c6: ff a3 08 00 00 00 jmp *0x8(%ebx)
4cc: 00 00 add %al,(%eax)
...
000004d0 :
4d0: ff a3 0c 00 00 00 jmp *0xc(%ebx)
4d6: 68 00 00 00 00 push $0x0
4db: e9 e0 ff ff ff jmp 4c0 <.plt>
000004e0 :
4e0: ff a3 10 00 00 00 jmp *0x10(%ebx)
4e6: 68 08 00 00 00 push $0x8
4eb: e9 d0 ff ff ff jmp 4c0 <.plt>
000004f0 :
4f0: ff a3 14 00 00 00 jmp *0x14(%ebx)
4f6: 68 10 00 00 00 push $0x10
4fb: e9 c0 ff ff ff jmp 4c0 <.plt>
00000500 :
500: ff a3 18 00 00 00 jmp *0x18(%ebx)
506: 68 18 00 00 00 push $0x18
50b: e9 b0 ff ff ff jmp 4c0 <.plt>
00000510 <__libc_start_main>:
510: ff a3 1c 00 00 00 jmp *0x1c(%ebx)
516: 68 20 00 00 00 push $0x20
51b: e9 a0 ff ff ff jmp 4c0 <.plt>
00000520 :
520: ff a3 20 00 00 00 jmp *0x20(%ebx)
526: 68 28 00 00 00 push $0x28
52b: e9 90 ff ff ff jmp 4c0 <.plt>
00000530 :
530: ff a3 24 00 00 00 jmp *0x24(%ebx)
536: 68 30 00 00 00 push $0x30
53b: e9 80 ff ff ff jmp 4c0 <.plt>
Disassembly of section .plt.got:
00000540 <__cxa_finalize>:
540: ff a3 f0 ff ff ff jmp *-0x10(%ebx)
546: 66 90 xchg %ax,%ax
00000548 <__gmon_start__>:
548: ff a3 f4 ff ff ff jmp *-0xc(%ebx)
54e: 66 90 xchg %ax,%ax
Disassembly of section .text:
00000550 <_start>:
550: 31 ed xor %ebp,%ebp
552: 5e pop %es