-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandom.txt
32 lines (22 loc) · 1 KB
/
random.txt
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
29
#include <stdio.h>
int main(){
unsigned int random;
random = rand(); // random value!
unsigned int key=0;
scanf("%d", &key);
if( (key ^ random) == 0xdeadbeef ){
printf("Good!\n");
system("/bin/cat flag");
return 0;
}
printf("Wrong, maybe you should try 2^32 cases.\n");
return 0;
}
The read() function doesn't have a seed upon which calc the randomization, so get the default value.
La funzione rand() non ha un seed da cui eseguire la randomizzazione che rimane quindi con un valore di default.
Ho copiato il file e fatto la printf del valore random iniziale, quindi trasformato in binario e messo in xor con 0xdeadbeef. Il valore risultante diminuito del valore massimo assumibile da un int.
-----------------------------------------------------------------
| input: | 3039230856 |
|--------|------------------------------------------------------|
| flag: | Mommy, I thought libc random is unpredictable... |
-----------------------------------------------------------------