Privilege Escalation in Penetration Testing

Privilege escalation is a critical objective in any exploit during penetration testing. By elevating privileges, an attacker can gain control over a system, access or modify sensitive files, and establish persistent backdoors. Achieving administrative or system-level access is rarely accomplished on the first attempt; instead, it often requires exploiting vulnerabilities to elevate privileges from an initial foothold.

Non-Kernel Privilege Escalation Techniques

Beyond kernel-specific exploits, several other attack vectors exist to escalate privileges by targeting services, drivers, and applications running with SYSTEM or administrator privileges. These attacks typically require local access to the target system. Below are some common techniques:

Security Account Manager (SAM) File Exploitation

  • Description: Dumping the contents of the SAM file allows attackers to obtain hashed passwords. Alternatively, copying the SAM file using Volume Shadow Service (VSS) enables offline password cracking.

Local Windows User Account Control (UAC) Bypass

  • Description: Bypassing UAC can be achieved through methods like process injection to leverage a trusted publisher certificate, enabling execution with elevated privileges.

Exploiting Weak Process Permissions

  • Description: Identifying processes with weak permissions allows attackers to inject malicious code into those processes, potentially running code with elevated privileges.

Leveraging Shared Folders

  • Description: Shared folders often have minimal restrictions. Attackers can search for sensitive information that may aid in privilege escalation.
  • Description: By exploiting weak folder permissions, unquoted service paths, or applications running from network shares, attackers can replace legitimate DLLs with malicious ones to execute code with elevated privileges.

Manipulating Writable Services

  • Description: Attackers can edit the startup parameters of a service, including its executable path and account settings. Unquoted service paths can be exploited to inject malicious applications that services run during startup.

Exploiting Missing Patches and Misconfigurations

  • Description: Searching for missing patches or common misconfigurations can reveal vulnerabilities that lead to privilege escalation opportunities.

Utilizing Metasploit for Privilege Escalation Exploits

To find local exploits in Metasploit that can facilitate privilege escalation, use the following command in the Metasploit console:

search exploit/windows/local -S Escalation

This command searches for Windows local exploit modules related to privilege escalation.


Tags:PrivilegeEscalationPenetrationTestingCybersecurityEthicalHackingMetasploit

Gehacktes-Overview