Skip to content

Instantly share code, notes, and snippets.

@shankaraman
Created June 12, 2015 13:09
Show Gist options
  • Save shankaraman/24b601047700320f2043 to your computer and use it in GitHub Desktop.
Save shankaraman/24b601047700320f2043 to your computer and use it in GitHub Desktop.
Testing Binjitsu with Return to libc
/*
* Compile the binary as root
* $ chmod +s vuln
*/
#include<stdio.h>
#include<unistd.h>
void c();
void c(char *arg)
{
char buggy[512];
printf("Address of a(): %p\n", a);
printf("uid is:%u\teuid is:%u\n",getuid(),geteuid());
strcpy(buggy,arg);
puts(buggy);
}
int main(int argc, char **argv)
{
c(argv[1]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment