Finding Interesting Files
Finding Interesting Files
Find SUID files
find / -perm -4000 -type f 2>/dev/null
Find SUID files owned by root
find / -uid 0 -perm -4000 -type f 2>/dev/null
Find GUID files
find / -perm -2000 -type f 2>/dev/null
Find world-writeable files
find / -perm -2 -type f 2>/dev/null
Find world-writeable files excluding those in /proc
find / ! -path "*/proc/*" -perm -2 -type f -print 2>/dev/null
Find word-writeable directories
find / -perm -2 -type d 2>/dev/null
Find rhost config files
find /home –name *.rhosts -print 2>/dev/null
Find *.plan files, list permissions and cat the file contents
find /home -iname *.plan -exec ls -la {} ; -exec cat {} 2>/dev/null ;
Find hosts.equiv, list permissions and cat the file contents
find /etc -iname hosts.equiv -exec ls -la {} 2>/dev/null ; -exec cat {} 2>/dev/null ;
See if you can access other user directories to find interesting files
ls -ahlR /root/
Show the current users’ command history
cat ~/.bash_history
Show the current users’ various history files
ls -la ~/.*_history
Can we read root’s history files
ls -la /root/.*_history
Check for interesting ssh files in the current users’ directory
ls -la ~/.ssh/
Find SSH keys/host information
find / -name "id_dsa*" -o -name "id_rsa*" -o -name "known_hosts" -o -name "authorized_hosts" -o -name "authorized_keys" 2>/dev/null |xargs -r ls -la
Check Configuration of inetd services
ls -la /usr/sbin/in.*
Check log files for keywords (‘pass’ in this example) and show positive matches
grep -l -i pass /var/log/*.log 2>/dev/null
List files in specified directory (/var/log)
find /var/log -type f -exec ls -la {} ; 2>/dev/null
List .log files in specified directory (/var/log)
find /var/log -name *.log -type f -exec ls -la {} ; 2>/dev/null
List .conf files in /etc (recursive 1 level)
find /etc/ -maxdepth 1 -name *.conf -type f -exec ls -la {} ; 2>/dev/null
As above
ls -la /etc/*.conf
Find .conf files (recursive 4 levels) and output line number where the word ‘password’ is located
find / -maxdepth 4 -name *.conf -type f -exec grep -Hn password {} ; 2>/dev/null
List open files (output will depend on account privileges)
lsof -i -n
Can we read roots mail
head /var/mail/root