Skip to content

Instantly share code, notes, and snippets.

@SafeEval
Created August 24, 2015 07:51
Show Gist options
  • Select an option

  • Save SafeEval/fd24bec9b21eaa2105df to your computer and use it in GitHub Desktop.

Select an option

Save SafeEval/fd24bec9b21eaa2105df to your computer and use it in GitHub Desktop.
// exit_x86-linux-att.c - inline exit() shellcode
static void exit()
{
__asm__(".att_syntax prefix");
__asm__ volatile(
"xor %eax,%eax \n" //zero out eax, no null
"xor %ebx,%ebx \n" //zero out ebx, no null"
"mov $42,%bl \n" //return code is 42"
"mov $1,%al \n" //exit is syscall 1"
"int $0x80 \n" //syscall interrupt"
);
}
int main()
{
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment