반응형


MD5 Brute Force

A password is required for the next level. vortex5.c and md5.h. a-z,A-Z,0-9 is the search space. The password length is 5 chars long, it was originally 7 chars long.

Collision(s) tested : 489265082 in 217 second(s), 361 millisec, 101 microsec.
Average of 2250932.1 hashes/sec.

소스가 너무길어서 파일로 첨부하겟음 .. 

vortex5.c


MD5를 브루트 포싱하는 문제다 

main 을 아래와 같이 수정해 주고 

int main(int argc, char **argv)

{

unsigned char buf[16];

MD5Context a;

char str[100] = { 0, };

int i;

int stri = 0;

int startstr[5] = { 0, 0, 0, 0, 0 };

char tx[6] = { 0, };

char *x = tx;

for (i = 0x30; i <= 0x39; i++)

str[stri++] = (char)i;

for (i = 0x41; i <= 0x5A; i++)

str[stri++] = (char)i;

for (i = 0x61; i <= 0x7a; i++)

str[stri++] = (char)i;


while (1){

int j;

for (j = 0; j<5; j++){

x[j] = str[startstr[j]];

}

startstr[4]++;

if (startstr[4] == stri){

startstr[3]++;

startstr[4] = 0;

}

if (startstr[3] == stri){

startstr[2]++;

startstr[3] = 0;

}

if (startstr[2] == stri){

startstr[1]++;

startstr[2] = 0;

printf("%s\n", x);

}

if (startstr[1] == stri){

startstr[0]++;

startstr[1] = 0;

}

if (startstr[0] == stri){

printf("Not Found PassWord");

break;

}

MD5Init(&a);

MD5Update(&a, x, strlen(x));

MD5Final(buf, &a);


if (memcmp(buf, "\x15\x5f\xb9\x5d\x04\x28\x7b\x75\x7c\x99\x6d\x77\xb5\xea\x51\xf7", 16) == 0){

printf("You got the right password, congrats!\n");

printf("password : %s\n", x);

break;

}

}

exit(0);

}

/tmp 에서 실행시켜주고 기다리다보면 아래처럼 키값이 나온다 

You got the right password, congrats!

password : rlTf6

이거를 가지고 password에 넣어주면 

vortex5@melinda:/tmp$ /vortex/vortex5

Password: 

6:36

You got the right password, congrats!

$ cat /etc/vortex_pass/vortex6

*uy5qDRb2

성공 

+)다시 풀어봐야될듯 

반응형

'과거의 컴퓨터 공부 > Overthewire@vortex' 카테고리의 다른 글

(vortex) level4-> level 5  (0) 2014.09.07
(vortex)level3->level4  (0) 2014.09.07
(Vortex)Level2->Level3  (0) 2014.09.05
(vortex) Level1 -> Level2  (0) 2014.09.05
(vortex) Level 0 -> Level1  (0) 2014.09.05
,