Shared Libraries & Interpreter Hijacking
LD_PRELOAD & Shared Library Hijacking
- Find Binaries That Honor LD_PRELOAD (Including SUID)
- Create a Malicious Shared Object
- Preload & Execute the SUID Binary
- If the binary loads
libcor another library, yourexploit.soruns as root. - Modify
/etc/ld.so.conf.dif Writable - Place your
.soin/home/user/mylibsand run the vulnerable binary.
Python Module Hijacking
- Locate SUID Python Scripts
- Create malicious python module
- Set PYTHONPATH and Run the Script
- If
vulnerable_suid_script.pydoesimport pickle(or another module you control), it spawns a root shell.