Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- string
- PMA
- FSB
- TUCTF
- pwnable
- CANARY
- reversing
- shellcode
- pwnable.kr
- BOF
- Bug
- picoCTF
- practicalmalwareanalysis
- Toddler's Bottle
- Reverse
- rev
- format
- ASM
- writeup
- toddler
- CTF
- Read
- Rookiss
- shellcraft
- anti
- pico
- Leak
- pwn
- 2018
- Bottle
Archives
- Today
- Total
제리의 블로그
pwnable.kr collision 본문
collision - 3 pt
Daddy told me about cool MD5 hash collision today.
I wanna do something like that too!
ssh col@pwnable.kr -p2222 (pw:guest)
col@ubuntu:~$ ls -l
total 16
-r-sr-x--- 1 col_pwn col 7341 Jun 11 2014 col
-rw-r--r-- 1 root root 555 Jun 12 2014 col.c
-r--r----- 1 col_pwn col_pwn 52 Jun 11 2014 flag
col.c 파일을 확인해볼까요
#include <stdio.h>
#include <string.h>
unsigned long hashcode = 0x21DD09EC;
unsigned long check_password(const char* p){
int* ip = (int*)p;
int i;
int res=0;
for(i=0; i<5; i++){
res += ip[i];
}
return res;
}
int main(int argc, char* argv[]){
if(argc<2){
printf("usage : %s [passcode]\n", argv[0]);
return 0;
}
if(strlen(argv[1]) != 20){
printf("passcode length should be 20 bytes\n");
return 0;
}
if(hashcode == check_password( argv[1] )){
system("/bin/cat flag");
return 0;
}
else
printf("wrong passcode.\n");
return 0;
}
passcode 를 넣어야하고
길이는 20 bytes
passcode 가 check_password() 함수로 넘어가게되는데
check_password() 함수는
길이 20 bytes 인 passcode 를
4 bytes 씩 끊어서
지역변수 res 에 합산한 다음
반환합니다.
hashcode는 0x21DD09EC 입니다.
이 문제는 답이 여러개가 있습니다.
>>> hex(ctypes.c_int(0x5a7a487a+0x367a307a+0x3077307a+0x3041304e+0x30303030).value)
'0x21dd09ecL'
>>> flat(0x5a7a487a, 0x367a307a, 0x3077307a, 0x3041304e, 0x30303030)
'zHzZz0z6z0w0N0A00000'
col@ubuntu:~$ ./col zHzZz0z6z0w0N0A00000
daddy! I just managed to create a hash collision :)
'Wargame > pwnable.kr' 카테고리의 다른 글
pwnable.kr flag (0) | 2018.08.29 |
---|---|
pwnable.kr bof (0) | 2018.08.24 |
pwnable.kr fd (0) | 2018.08.24 |
pwnable.kr echo1 (0) | 2018.08.22 |
pwnable.kr horcruxes (1) | 2018.08.20 |
Comments