Skip to content

Instantly share code, notes, and snippets.

@SafeEval
Last active August 29, 2015 14:28
Show Gist options
  • Save SafeEval/64e442f9ee1981e4baf8 to your computer and use it in GitHub Desktop.
Save SafeEval/64e442f9ee1981e4baf8 to your computer and use it in GitHub Desktop.
/* Generated by shextor
*
* exit_x86-linux_shextor.c - shellcode harness
*
* SC Length: 10 bytes
*
* Time: 2015-08-23 16:58:04
* Execuable: exit
* Format: elf32-i386
* SHA1: 28e8ef986ec2ef8789662d7cd585aed4a854740d
* MD5: 4ec162904054a2e83121dbdfbf2d4169
*
* To disable compile-time stack protections:
* gcc -fno-stack-protector -z execstack -o exit_x86-linux_shextor exit_x86-linux_shextor.c
* To force 32-bit compilation:
* gcc -m32 -fno-stack-protector -z execstack -o exit_x86-linux_shextor exit_x86-linux_shextor.c
*/
char sc_expanded[] =
// _start:
"\x31\xc0" // xor %eax,%eax
"\x31\xdb" // xor %ebx,%ebx
"\xb3\x2a" // mov $0x2a,%bl
"\xb0\x01" // mov $0x1,%al
"\xcd\x80" // int $0x80
;
char sc_compact[] =
"\x31\xc0\x31\xdb\xb3\x2a\xb0\x01\xcd\x80"
;
int main()
{
int (*func)();
func = (int (*)()) sc_compact;
(int)(*func)();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment