Gathering Information of the System
To escalate privileges on a Linux system, it’s crucial to gather as much information about the environment as possible. This helps identify potential weaknesses or misconfigurations that can be exploited. Below are some key commands that can be used for enumeration, along with a few additional ones to broaden the assessment.
Linux Privilege Escalation: Environment Enumeration
Check OS Information:
Contains details about the operating system version, distribution, and other useful information.
Inspect the PATH Variable:
Reveals directories in the system's PATH, which could expose writable or insecure paths.
List Environment Variables:
Lists all environment variables. Sensitive information like credentials might be exposed.
Check Kernel Version:
Displays kernel version, system architecture, and other details. Certain versions may have known vulnerabilities.
List Available Shells:
Shows available login shells. Vulnerable or misconfigured shells can provide opportunities for escalation.
View Routing Table:
Displays the routing table, helping identify available network interfaces.
Check ARP Table:
Shows the ARP table, revealing other hosts the target machine communicates with.
List SUID and SGID Files:
Finds SUID binaries, which run with the file owner's privileges (often root).
Check for Running Processes:
Lists all running processes. Look for processes running as root or with elevated privileges.
Check for Installed Packages:
Lists installed packages. Some might have known vulnerabilities or misconfigurations.
Check Crontab Entries:
Lists scheduled cron jobs. Misconfigured cron jobs running as root can be exploited.
Check Active Network Connections:
Displays active network connections and listening ports, which can help identify services running as root.
View Mounted File Systems:
Lists mounted file systems. Uncommon or insecure mounts can offer opportunities for privilege escalation.
Check Writable Directories for Other Users:
Identifies world-writable directories that could be leveraged to inject malicious files.
Inspect sudo Privileges:
Lists what commands the current user is allowed to run with sudo, revealing potential escalation paths.
Last updated