Skip to content

Instantly share code, notes, and snippets.

@0xTowel
Last active November 14, 2017 20:39
Show Gist options
  • Save 0xTowel/8f2bfbc293a04a8263dc619d130da0a0 to your computer and use it in GitHub Desktop.
Save 0xTowel/8f2bfbc293a04a8263dc619d130da0a0 to your computer and use it in GitHub Desktop.
Naslr - A POC to start a bash shell with no ASLR via SYS_personality.
/* Naslr: Starts a bash shell with no ASLR
* Build: gcc naslr.c -o naslr
*
* Towel - 2017
*/
#include <sys/personality.h>
#include <syscall.h>
#include <unistd.h>
#include <stdlib.h>
#include <err.h>
int main(int argc, char *argv[])
{
/* Syscall 0x87 - Set the process execution domain */
((long)syscall(SYS_personality, 0x0040000));
execv("/bin/bash", argv);
err(EXIT_FAILURE, "\n[!] Failed to start %s", "/bin/bash");
return EXIT_FAILURE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment