분석 대상 파일은 64bit 버전으로 컴파일 되어있으며 Packing 되어있다.
asecbug@box:~/pwnable_kr$ file flag
flag: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, stripped
파일을 실행하면 "I will malloc() and strcpy the flag there. take it." 문자열을 출력하고 종료한다.
asecbug@box:~/pwnable_kr$ ./flag
I will malloc() and strcpy the flag there. take it.
IDA로 Packing된 파일의 문자열을 확인 하였을 때 upx Packer와 관련된 문자열이 확인 되었다.
LOAD:0000000000443668 00000018 C '12Wr%W345%Wr%67x!Wr892
LOAD:000000000044A695 00000010 C //upx.sf.net $\n
LOAD:000000000044A7A0 0000000E C proc/self/exe
upx unpack 후 파일의 정보이다.
asecbug@box:~/pwnable_kr$ file unpack_flag
unpack_flag: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.24, BuildID[sha1]=96ec4cc272aeb383bd9ed26c0d4ac0eb5db41b16, not stripped
Unpack된 분석 대상 파일을 IDA로 확인 시 flag에 대한 정보를 확인 할 수 있다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | .text:0000000000401164 push rbp .text:0000000000401165 mov rbp, rsp .text:0000000000401168 sub rsp, 10h .text:000000000040116C mov edi, offset aIWillMallocAnd ; "I will malloc() and strcpy the flag the"... .text:0000000000401171 call puts .text:0000000000401176 mov edi, 100 .text:000000000040117B call malloc .text:0000000000401180 mov [rbp+var_8], rax .text:0000000000401184 mov rdx, cs:flag ; flag : UPX...? sounds like a delivery service :) .text:000000000040118B mov rax, [rbp+var_8] .text:000000000040118F mov rsi, rdx .text:0000000000401192 mov rdi, rax .text:0000000000401195 call sub_400320 .text:000000000040119A mov eax, 0 .text:000000000040119F leave .text:00000000004011A0 retn .text:00000000004011A0 main | cs |