Skip to content

Instantly share code, notes, and snippets.

@superkojiman

superkojiman/ex1 Secret

Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superkojiman/6c113a9ff991d9f3b7da to your computer and use it in GitHub Desktop.
Save superkojiman/6c113a9ff991d9f3b7da to your computer and use it in GitHub Desktop.
Vulnerable binary and source code for Simplifying Format String Exploits with libformatstr tutorial.
/* compile: gcc -Wno-format-security ex1.c -o ex1 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void win() {
system("/bin/sh");
}
void main(int argc, char *argv[]) {
char buf[103];
fgets(buf, 103, stdin);
buf[strlen(buf)-1] = 0x0;
printf(buf);
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment