Privilege Escalation Flashcards
What is the process for enumerating users on a Windows machine?
- whoami
- net user
- - gains additional information about the user you are logged in with - net users
- - discover other user accounts on the system
What is the process for enumerating users on a Linux machine?
- whoami
- id
- cat /etc/passwd
- - enumerates other users on the system
How do you enumerate the Operating System Version and Architecture on a Windows machine?
c:> systeminfo | findstr /B /C:”OS Name” /C:”OS Version” /C:”System Type”
How do you enumerate the Operating System Version and Architecture on a Linux machine?
- cat /etc/issue
- cat /etc/*-release
- uname -a
How do you list running processes on a Windows machine?
tasklist /SVC
How do you list running processes on a Linux machine?
ps axu
How do you enumerate all TCP/IP network configurations on a Windows machine?
ipconfig /all
How do you enumerate all TCP/IP network configurations on a Linux machine?
route print
How do you list active network connections on a Windows machine?
netstat -ano
How do you list active network connections on a Linux machine?
- ifconfig
- ip a
- /sbin/route
- ss -anp
How do you enumerate firewall settings on a Windows system?
- netsh advfirewall show currentprofile
- - netsh advfirewall firewall show rull name=all
How do we enumerate Scheduled Tasks on a Windows system?
– schtasks /query /fo LIST /v
How do we enumerate Scheduled Tasks on a Linux system?
- ls -lah /etc/cron*
- - cat /etc/crontab
How do we enumerate Installed Applications on a Windows machine?
– wmic product get name, version, vendor
How do we enumerate Patch Levels and Patch Levels on a Windows machine?
– wmic qfe get Caption, Description, HotFixID, InstalledOn
How do we enumerate Installed Applications on a Windows machine?
dpkg -l
On a Windows machine, how would you search for any file or directory in the Program Files directory that allows the ‘Everyone’ group ‘write’ permissions?
– accesschk.exe -uws “Everyone” “C:\Program Files”
What PowerShell cmdlet retrieves all permissions for a given file or directory?
Get-Acl
What additional cmdlet needs to be used with Get-Acl to run recursively?
Get-ChildItem
How would we use Get-Acl and Get-ChildItem cmdlets to get every file and directory under the Program Files directory that allows the ‘Everyone’ group to modify?
Get-ChildItem “C:\Program Files” -Recurse | Get-ACL | ?{$_.AccessToString -match “Everyone\sAllow\s\sModify”}
In Linux, how do you find every directory writable by the current user on the target system?
find / -writable -type d 2>/dev/null
How do you enumerate Unmounted Disks on a Windows machine?
- mountvol
How do we enumerate Unmounted Disks on a Linux machine?
- cat /etc/fstab
- mount
- /bin/lsblk
What are Device Drivers?
-A ‘driver’ is a software component that lets the operating system and a device communicate with each other.
In Windows, how can you enumerate Device Drivers and Kernel Modules?
- C:>powershell
- - PS C:> driverquery.exe /v /fo csv | ConvertFrom-CSV | Select-Object ‘Display Name’, ‘Start Mode’, Path
In Windows, how can we get a list of Loaded Drivers?
- We can use the Get-WmiObject cmdlet to get the Win32_PnPSignedDriver WMI instance, which provides digital signature information about the drivers
- Get-WmiObject Win32 PnPSignedDriver | Select-Object DeviceName, DriverVersion, Manufacturer | Where-Object {$_.DeviceName -like “VMware”}
How can we enumerate the Loaded Kernel Modules?
– lsmod
How can we find out more information about a specific Kernel Module in Linux? (Ex. ‘libata’ Kernel Module)
– /sbin/modinfo libata
On Windows systems, which registry setting should be checked on which registries for a “privesc shortcut”?
Why and How?
- On Windows systems, we should check the status of the ‘AlwaysInstallElevated’ registry setting
- If this key is set to ‘1’ (enabled) in either HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE, any user can run Windows Installer packages with Elevated Privileges.
- We can use ‘reg query’ to check these settings:
- C:> reg query HKEY_CURRENT_USER\Software\Policies \Microsoft\Windows\Installer
- C:> reg query HKEY_LOCAL_MACHINE\Software\Policies \Microsoft\Windows\Installer
In Linux, what should we search for to see if we can get files to run as the ‘root’ user? How is this located?
- SUID files
- if the SUID permission is set on a binary it will run with the permissions of the file owner
- if a binary has the SUID bit set and the file is owned by ‘root’, any local user will be able to execute that binary with elevated privileges
- find / -perm -u=s -type f 2>/dev/null
What is an automated tool to check for Windows privesc vulnerabilities? what command will provide all privesc vulns and groups?
- windows-privesc-check
- - C:> windows-privesc-check2.exe –dump -G