Mohammad Abd El-Fattah Mohammad
Cybersecurity & AI Engineer
Open to opportunities

Pentesting Notes

Privilege Escalation

By Mohammad Abd El-Fattah Mohammad · Last updated 2024-09-23 · 2 min read

Privilege Escalation

Privilege escalation is a critical technique in cybersecurity that involves gaining elevated access to a system, often from a limited user account to a privileged one like root or administrator. This allows attackers to execute commands with elevated privileges, potentially compromising the entire system.

Common Techniques

1. Exploiting System Vulnerabilities:

  • Remote Code Execution (RCE): This allows an attacker to execute arbitrary code on the target system.
  • Privilege Escalation Vulnerabilities: Specific vulnerabilities in software or operating systems that directly elevate privileges.

2. Password Cracking:

  • Brute Force: Trying every possible combination of characters.
  • Dictionary Attacks: Using a list of common passwords.
  • Rainbow Tables: Precomputed tables of hashed passwords.

3. Credential Theft:

  • Keyloggers: Record keystrokes to capture passwords.
  • Phishing: Tricking users into revealing credentials.
  • Credential Dumping: Extracting stored credentials from memory or files.

4. Exploiting Weak Configurations:

  • Default Credentials: Using default usernames and passwords.
  • Misconfigured Services: Services running with excessive privileges.
  • Weak Permissions: Files or directories with incorrect permissions.

5. Lateral Movement:

  • Pass-the-Hash: Using a stolen hash to authenticate to other systems.
  • Token Stealing: Capturing a user's authentication token to impersonate them.

Examples Of Privilege escalation

Linux:

  • Sudo Vulnerability: If a user can execute a command with sudo and the command can be exploited to execute arbitrary code, privilege escalation is possible.
  • Weak sudoers File: Incorrectly configured sudoers files can grant excessive privileges.
  • Exploiting Setuid/Setgid Programs: Programs that run with elevated privileges can be exploited if they have vulnerabilities.

Windows:

  • UAC Bypass: Exploiting vulnerabilities in User Account Control (UAC) to elevate privileges.
  • Exploiting Services: Services running with high privileges can be targeted for exploitation.
  • Token Stealing: Capturing a high-privilege token to impersonate the user.

Mitigation Strategies

  • Regular Patching: Keep systems up-to-date with the latest security patches.
  • Strong Password Policies: Enforce strong, unique passwords.
  • Least Privilege Principle: Grant users only the minimum necessary privileges.
  • Regular Security Audits: Conduct regular security assessments to identify vulnerabilities.
  • Security Awareness Training: Educate users about security best practices.

Source file in my repo: Privilege Escalation/Privilege Escalation.md