https://stackoverflow.com/questions/25812181/is-it-possible-to-override-main-method-using-ld-preload
#include <stdio.h>
int main (void)
{
puts("Hello, world!");
return 0;
}
#include <stdio.h>
int puts (const char *s)
{
return printf("Hijacked puts: %s\n", s);
}
gcc -o puts.so -shared -fPIC puts.c
gcc main.c -o main
LD_PRELOAD=./puts.so ./main
#Hijacked puts: Hello, world!