#include<stdio.h>intmain(){unsignedintrandom;random=rand();// random value!
unsignedintkey=0;scanf("%d",&key);if((key^random)==0xdeadbeef){printf("Good!\n");system("/bin/cat flag");return0;}printf("Wrong, maybe you should try 2^32 cases.\n");return0;}
The mistake here is clear, rand() is called without calling srand()
first. According to the rand manpage:
If no seed value is provided, the rand() function is automatically seeded with a value of 1.
So, running the program below gives us the key we should enter: