suid.sh

#!/bin/bash

Define a function to test SUID files

test_suid() { local file="$1" local result

Check if the file exists and is executable

if [ -x "$file" ]; then # Attempt to execute the file if [ -n "$(timeout 2 ./"$file" 2>&1)" ]; then result="Vulnerable" else result="Not Vulnerable" fi else result="Not Executable" fi

echo "$file: $result" }

Find all SUID files on the system

suid_files=$(find / -type f -perm /4000)

Loop through each SUID file and test it

for file in $suid_files; do test_suid "$file" done

Last updated