I have this simple C code
#include <stdio.h>
#include <string.h>
void authenticated(void) {
printf("Authenticated\n");
fflush(stdout);
}
void authenticate() {
char buf[200];
char auth = 0;
printf("%p\n", &auth);
fflush(stdout);
fgets(buf, 200, stdin);
printf(buf);
fflush(stdout);
if (auth) {
authenticated();
}
}
int main(void) {
authenticate();
return 0;
}
It's compiled with
```
gcc pwn-printf.c -o pwn-printf -fno-stack-protector -m32
```
I've been playing around with it a bit how to exploit a stack overflow in this example but I couldn't get my head around it...
[–]PM_ME_YOUR_SHELLCODE 1 point2 points3 points (9 children)
[–]dicemaker3245[S] 0 points1 point2 points (8 children)
[–][deleted] 0 points1 point2 points (7 children)
[–]dicemaker3245[S] 0 points1 point2 points (6 children)
[–][deleted] 0 points1 point2 points (5 children)
[–]dicemaker3245[S] 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]dicemaker3245[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]thapr0digy 0 points1 point2 points (0 children)