Privilege Escalation
Windows
Note: if you have a valid user credential you can authenticate in windows target from SMB, RDP, WinRM.
Automation script
UAC Bypass
User Account Control (UAC) is a feature that enables a consent prompt for elevated activities.
Prerequisites:
User must be a member of the Administrators group.
net localgroup administrators
Full interactive shell with the victim like meterpreter (a common nc.exe shell is not enough).
(1) Metasploit
(2) UACME
Impersonate Tokens
Metasploit - incognito
Password in configuration file (Unattend.xml)
An answer file is an XML-based file that contains setting definitions and values to use during Windows Setup. Answer files (or Unattend files) are used by Administrators when they are setting up fresh images as it allows for an automated setup for Windows systems.
Extract password and decode it (from base64)
Credential Dumping (Mimikatz - Kiwi - Hashdump)
Prerequisites: User must be a member a local Administrators.
(1) hashdump (Metasploit - Meterpreter)
(2) Kiwi (Metasploit - Meterpreter)
(3) Mimikatz
Pass the Hash
Notes:
Empty LM hash:
AAD3B435B51404EEAAD3B435B51404EE
(means its non-use).AAD3B435B51404EEAAD3B435B51404EE:<NTLM>
With
hashdump
you have the right format
Other
Powershell History
Saved Windows Credentials
cmdkey /list
runas /savecred /user:admin cmd.exe
Scheduled Tasks
Insecure Permissions on Service Executable
Unquoted Service Paths
Insecure Service Permissions
Windows Privileges
Unpatched Software
Linux
Vulnerable program
Search scripts that execute programs or programs. Search for any vulnerable version. One example: chkrootkit v0.49 (running as root)
Weak Permissions
Sudo
SUID - custom binary
Premise: you have binary_name
(with suid) that use/load/execute loaded_binary
Extract strings from the binary – look for shared libraries or binaries being loaded / executed at runtime
(1) Method
(2) Method
Delete the loaded binary and replace with a new one:
Other
sudo -l
setenv?
SUID/GUID
Look for capabilities
History Files
Docker group
Cron jobs
SSH Keys
PATH
NFS
Writable /etc/shadow
Writable /etc/passwd
Are there scripts that use commands?
If the command is executed without full path you can modify PATH variable
strings <program_name>
you see
tail -f /var/log/nginx/access.log
chmod +x /tmp/tail
export PATH=/tmp:$PATH
./<program_name>
Is there a database? Can I access to it?
Look at config file or source code of webpages connecting to db
Look at the source code of the php,py,jsp ... files of the website
Especially login files. Any password?
Writable authorized_key folder?
generate new ssh keys
Can I read some file with sudo?
/root/root.txt, /etc/shadow, /root/.ssh/id_rsa
Can I write a file in the root user directory?
generate ssh key with ssh-keygen and save it in the root user dir
Kernel Exploits
Linpeas.sh
Last updated