Chapter 10: Attacking Hosts, Cloud Technologies, and Specialized Systems Flashcards
SUID/SGID
Set User ID / Set Group ID
Tells Linux OS that the executable files they’re set for should be run as the owner of the file, not the user who launched it
find / -perm -4000 (root find command that shows all SUID files and folders)
Linux executables that can be used for privilege escalation if SUID permissions are set:
* cp
* find
* Bash shell
* more
* less
* VIM
* Nano
* nmap
Unsecure SUDO
All users who can use sudo on Linux are listed in the sudoers file
Always check the file after gaining acces to identify new targets and what rights they have
Shell Upgrade Attacks
Restricted shells limit commands or apps that can be used as well as restrict users from:
* Changing directory
* Set PATH or SHELL variables
* Specifcy absolute paths
* Redirect output
* ETC
Breaking out of restricted shells can be done by starting a new unrestricted shell or using VIM that has a built in shell function
In general, when faced with a restricted shell, do the following:
* Check the commands you can run, particularly looking for SUID commands
* Check if you can use sudo and what sudo commands you can execute
* Check for Perl, Python, Ruby, etc that you can run
* Check if you can use redirect operators like pipes and carrots and escape characters like single / double quote, etc
Linux Kernel Exploits
Often requires local access to the system
Most kernel patches require a system reboot, and admins may delay kernel updates as a result
Presents an oppty for attackers to gain access since they might not be patched due to a lower perceived risk
To check if you can use Linux for potential kernel exploits:
* lsb_release -a (checks OS release)
* uname -a (checks kernel version)
Acquiring and Using Hashes
Windows uses NTLM password hashes for authentcation purposes, and tools like Mimikatz can easily obtain them
NTLM hashes are unsalted
Pass the hash attack is harvesting the NTLM hash and then injecting it into LSASS, SMB, or WMI it as the password since Windows doesn’t verify the actual contents of the password, just the hash
Sysinternals tool psexec can directly accept NTLM hashes as an argument instead of a password
LSA Secrets
Registry location:
* HKEY_LOCAL _MACHINE/Security/Policy/Secrets
Contains the encrypted password of logged in user, but the key is stored in the parent Policy key in the Registry
If you gain admin access to the Registry you can get both
SAM Database
Windows Security Accounts Manager
One of the first places that you want to target when you gain access to a Windows system
Contains password hashes that can be dumped with Mimikatz or Metasploit using Mimikatz functionality
Windows Kernel Exploits
Metsaploit module to list any missing patches:
* post/windows/gather/enum_patches
Reference that list against vulnerability databases to determine if an exploit exists for the unpatched issue
Metasploit has other exploit modules for many of the Windows kernel exploits discovered over, allowing you to assess flaws and attempt exploits once you access the system
Unsecure File and Folder Permissions
Linux:
* ls and grep the output for specific persmissions
Windows:
* AccessEnum (sysinternals)
* Accesschck (sysinternals)
* Get-Acl (ps1)
* icacls
Credential Acquisition
Windows:
* Mimikatz (standalone)
* Mimikatz (Metasploit meterpreter function)
Linux:
* creddump package on Kali
* cachedump (dumps cached creds)
* lsadump (dumps LSA secrets)
* pwdump (dumps password hashes)
Offline Password Cracking
Hashcat
* Uses GPU to crack passwords at high rate of speed
* Much faster than tools like John, which are CPU bound
RainbowCrack
* Rainbow tables for Linux and Windows
* Pre-computed tables that allow you to search for a password hash versus the password itself
John the Ripper
* Autodetects common hashes while providing support for Linux and Windows password hashes
* Custom dictionaries and other word lists
Cain and Abel
* Outdated password recovery tool for Windows NT, 2000, and XP
Credential Testing and Brute Force Tools
Hydra
* thc-hydra
* Brute force dictionary attack tool that works against many protocols and services
* SSH, http(s), SMB, databases
* hydra -l [userid] -p [wordlist] [target ip] -t [timing] [protocol]
Medusa
* Similar to Hydra, and if Hydra works for you likely won’t need Medusa
Patator
* Less script kiddie friendly and difficult to use
* Variety of features that might be useful though
Directories and Filename Brute Force
W3AF
* Web App Attack and Audit Framework
* Open source web app security scanner that includes directory and filename brute forcing
DirBuster
* Dated but still useful Java app that brute forces directories and filenames on web servers
* Hasn’t been updated since 2013
Wordlists and Dictionaries
CeWL
* Custom Word List Generator
* Ruby app that allows you to spider a website based on a URL and depth setting, then generate a wordlist from the files and web pages it finds
* Running against target org can help genreate a customer wordlist
* Add words manually based on OSINT
Proxychains
Use to tunnel any traffic through a proxy server with full support for HTTP, SOCKS4, and SOCKS5 proxy servers
Can chain multiple proxies together to further conceal actions
proxychains [application command]
By default it uses TOR, but you can configure it to use others vai /etc/proxychains.conf