Skip to content

Instantly share code, notes, and snippets.

@skout23
Last active April 26, 2018 08:02
Show Gist options
  • Save skout23/190a34351e57e195141cf8ae66751fe2 to your computer and use it in GitHub Desktop.
Save skout23/190a34351e57e195141cf8ae66751fe2 to your computer and use it in GitHub Desktop.
simple buffer_overflow for testing afl
/*
Compile with:
afl-gcc -fno-stack-protector -z execstack buffer_overflow.c -o buffer_overflow
gcc -fno-stack-protector -z execstack buffer_overflow.c -o buffer_overflow
*/
#include <stdio.h>
#include <string.h>
int main(void)
{
char login[32];
char passwd[32];
printf("Login: \n");
gets(login);
printf("Password: \n");
gets(passwd);
if (strcmp(login, "root") == 0) {
if (strcmp(passwd, "somwead") == 0) {
printf("Access granted!\n");
return 0;
}
}
printf("Accesss Denied.\n");
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment