Skip to content

Instantly share code, notes, and snippets.

@tsutsui
Created April 30, 2025 16:29
Show Gist options
  • Save tsutsui/1d7949118df0809e1dc8ce6325f96d00 to your computer and use it in GitHub Desktop.
Save tsutsui/1d7949118df0809e1dc8ce6325f96d00 to your computer and use it in GitHub Desktop.
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#define BUFSIZE 1024
void (*bomb)(void);
static const unsigned char a[] = {
//0xf2, 0x43, 0xf4, 0x7a, // silent hard hang
//0xf2, 0x43, 0xf5, 0x18, // silent hard hang
//0xf2, 0x44, 0xf4, 0x7a, // silent hard hang
0xf2, 0x44, 0xf0, 0x00, // silent hard hang
//0xf2, 0x44, 0xf0, 0x00, 0x4e, 0x75 //
//0xf2, 0x44, 0x00, 0x00, // SIGSEGV
//0xf2, 0x43, 0x4e, 0x75, // SIGSEGV
//0xf2, 0x43, 0x4e, 0x7b, 0x00, 0x02, // SIGSEGV
//0xf6, 0x32, 0xf5, 0x18, // SIGILL
};
int
main(int argc, char *argv[])
{
unsigned char *p;
p = malloc(BUFSIZE);
memset(p, 0, BUFSIZE);
memcpy(p, a, sizeof(a));
bomb = (void *)p;
printf("address = %p\n", p);
(*bomb)();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment