💾 Archived View for thebackupbox.net › ~epoch › blog › sticky captured on 2024-12-17 at 10:13:11. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-07-09)
-=-=-=-=-=-=-
I was wondering if a sticky bit on a program would prevent LD_PRELOAD from working.
Similar to how an suid or sgid bit prevents it from working.
epoch@batou$ cat test.c #include <stdio.h> int main(int argc,char *argv[]) { puts("ohai"); return 0; } epoch@batou$ gcc -o test test.c epoch@batou$ cat lib.c int puts(char *s) { return printf("lol hacked: %s\n",s); } epoch@batou$ gcc -fPIC -shared -o lib.so lib.c [warnings] epoch@batou$ chmod o+t test-sticky epoch@batou$ ./test ohai epoch@batou$ ./test-sticky ohai epoch@batou$ LD_PRELOAD=$(pwd)/lib.so ./test lol hacked: ohai epoch@batou$ LD_PRELOAD=$(pwd)/lib.so ./test-sticky lol hacked: ohai
A sticky bit on a program doesn't prevent LD_PRELOAD from working.
Oh well.
Guess a static binary would work for LD_PRELOAD-safe program.