728x90

Daddy told me about cool MD5 hash collision today.

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;
}

 

 

그냥 글자수 끼워맞추기 문제인것같다. 

21DD09EC >> 6C5CEC8*5

                   >>6C5CEC8*4  + 6C5CECC

 

페이로드 >

./col `python -c 'print "\xc8\xce\xc5\x06"*4+"\xcc\xce\xc5\x06"'`

daddy! I just managed to create a hash collision :)

 

728x90

'pwnable > pwnable.kr' 카테고리의 다른 글

[pwnable.kr] mistake  (0) 2020.10.03
[pwnable.kr] lotto  (0) 2020.09.23
[pwnable.kr] flag  (0) 2020.09.23
[pwnable.kr] bof  (0) 2020.09.23
[pwnable.kr] fd  (0) 2020.09.22

+ Recent posts