Privilege Escalation Discovery
Introduction
PowerShell is an indispensable tool for security operations (SecOps), offering extensive capabilities for managing and securing enterprise networks. Its deep integration with Windows systems, robust scripting functionality, and comprehensive library of cmdlets make it a critical asset for conducting Privilege Escalation Discovery activities in digital forensics and incident response (DFIR) investigations. Privilege escalation is a tactic commonly used by attackers to gain elevated access within a network, enabling them to execute unauthorised actions and evade security measures. PowerShell empowers SecOps teams to efficiently detect and analyse privilege escalation techniques, providing actionable insights to mitigate threats and protect enterprise systems.
Capabilities of PowerShell for Privilege Escalation Discovery in DFIR
1. Enumerating Local and Domain Users:
PowerShell enables analysts to query user accounts and groups on local systems and Active Directory (AD). This helps detect newly created accounts, unauthorised privilege assignments, or abnormal group memberships that could indicate privilege escalation attempts.
2. Analysing Privilege Changes:
With PowerShell, analysts can monitor privilege escalation events, such as changes to user rights, group policies, or role assignments. This includes tracking modifications to critical groups like Administrators, Domain Admins, or Enterprise Admins.
3. Detecting Misconfigurations and Exploitable Settings:
Attackers often exploit misconfigurations to elevate privileges. PowerShell allows for the inspection of file and folder permissions, service configurations, and registry keys to identify weaknesses, such as improperly set SeTakeOwnershipPrivilege
or SeDebugPrivilege
.
4. Identifying Credential Exposure:
Privilege escalation often involves harvesting credentials from compromised systems. PowerShell facilitates the detection of exposed credentials, such as plaintext passwords in scripts, memory, or configuration files, which attackers might use to gain elevated access.
5. Monitoring Process and Service Escalation:
PowerShell provides detailed insights into running processes and services, helping analysts identify processes with elevated privileges or services that have been modified to execute malicious binaries.
6. Event Log Analysis:
Privilege escalation activities often leave traces in Windows event logs. PowerShell enables querying of security logs for specific events, such as changes to user rights, process creation with elevated privileges, or attempts to exploit privileged accounts.
7. Hunting for Privilege Escalation Tools:
Attackers commonly use tools like Mimikatz or PsExec for privilege escalation. PowerShell allows analysts to search for the presence of these tools, as well as their execution traces in system logs or memory.
Efficiency Provided by PowerShell in Privilege Escalation Discovery
Comprehensive Visibility: PowerShell offers access to critical system components and logs, allowing security teams to detect privilege escalation attempts across both local systems and domain environments.
Real-Time Analysis: PowerShell’s dynamic querying capabilities provide real-time insights into privilege-related activities, enabling rapid detection and response to escalation attempts.
Scalability: Using PowerShell Remoting, analysts can perform privilege escalation discovery across multiple endpoints simultaneously, ensuring coverage in large enterprise networks.
Automation and Consistency: PowerShell scripts automate repetitive tasks, such as querying group memberships or analysing user rights, ensuring consistent and efficient investigation workflows.
Customisable Detection: PowerShell can be tailored to detect specific privilege escalation techniques outlined in the MITRE ATT&CK framework, ensuring alignment with known adversarial tactics.
Integration with Security Tools: PowerShell integrates seamlessly with platforms like Microsoft Sentinel, Defender for Endpoint, and other SIEMs, enabling enriched detection and automated remediation workflows.
By leveraging PowerShell’s capabilities, SecOps teams can efficiently identify and mitigate privilege escalation activities, enhancing their ability to protect enterprise networks and maintain a robust security posture.
Privilege Escalation Discovery
1. Monitoring Process and Service Changes
1.1. Detecting New Administrative Process Creation
Purpose: Identify processes started with administrative privileges that may indicate privilege escalation.
1.2. Monitoring for New Services with Elevated Privileges
Purpose: Detect the creation of new services that run with elevated privileges.
2. User and Group Changes
2.1. Detecting New User Account Creation
Purpose: Identify new user accounts that may have been created with elevated privileges.
2.2. Monitoring for Group Membership Changes
Purpose: Detect changes in group memberships, particularly in administrative groups.
3. Registry and System Configuration
3.1. Monitoring Registry Key Changes for Escalation Paths
Purpose: Identify changes to registry keys that may enable privilege escalation.
3.2. Detecting UAC Bypass Techniques
Purpose: Detect changes to registry keys or system settings that might indicate UAC bypass attempts.
4. Scheduled Tasks and Services
4.1. Detecting Changes to Scheduled Tasks
Purpose: Identify changes to scheduled tasks that may allow privilege escalation.
4.2. Monitoring Service Configuration Changes
Purpose: Detect changes to service configurations that may provide elevated access.
5. Access Control and Permissions
5.1. Monitoring Changes to ACLs on Sensitive Files
Purpose: Detect modifications to access control lists (ACLs) on sensitive system files.
5.2. Detecting Changes to Important Security Settings
Purpose: Identify changes to security settings that might indicate privilege escalation.
6. Executable and Script Monitoring
6.1. Detecting Unusual Executables in System Directories
Purpose: Identify executables in system directories that may be used for privilege escalation.
6.2. Monitoring Script Execution with Elevated Privileges
Purpose: Detect the execution of scripts with administrative privileges.
7. Application and Service Installation
7.1. Detecting Installation of Potentially Malicious Software
Purpose: Identify the installation of software that may be used for privilege escalation.
7.2. Monitoring Changes to Auto-Start Applications
Purpose: Detect changes to auto-start applications that could indicate persistence or privilege escalation.
8. Exploit Detection and Mitigation
8.1. Monitoring for Known Exploit Attempts
Purpose: Detect attempts to exploit known vulnerabilities for privilege escalation.
8.2. Detecting Kernel Driver Installation
Purpose: Identify the installation of kernel drivers, which may be used to escalate privileges.
9. Audit Policy and Event Log Monitoring
9.1. Monitoring Changes to Audit Policies
Purpose: Detect changes to audit policies that might indicate attempts to cover privilege escalation activities.
9.2. Detecting Clearing of Event Logs
Purpose: Identify attempts to clear event logs, which may indicate an attempt to hide evidence of privilege escalation.
10. Domain and Network-Level Privilege Escalation
10.1. Monitoring Changes to Domain Admin Group
Purpose: Detect unauthorized changes to the Domain Admins group.
10.2. Detecting Changes to Group Policy Objects (GPOs)
Purpose: Identify changes to GPOs that may indicate attempts to escalate privileges.
Additional Discovery Techniques
1. Monitoring Account Privilege Changes
1.1. Detecting Changes in User Group Membership
Purpose: Identify users added to high-privilege groups, such as Administrators.
1.2. Monitoring User Account Control (UAC) Changes
Purpose: Detect changes to UAC settings that may indicate privilege escalation attempts.
2. Service and Process Manipulation
2.1. Detecting Service Configuration Changes
Purpose: Identify changes to service configurations that might be used for privilege escalation.
2.2. Monitoring for Abnormal Parent-Child Process Relationships
Purpose: Detect unusual parent-child process relationships that might indicate process injection or manipulation.
3. Scheduled Tasks and Cron Jobs
3.1. Detecting Creation of High-Privilege Scheduled Tasks
Purpose: Monitor for the creation of scheduled tasks with high privileges.
3.2. Monitoring Modification of Scheduled Tasks
Purpose: Identify modifications to scheduled tasks, which can be used for privilege escalation.
4. Exploitation of Vulnerabilities and Misconfigurations
4.1. Detecting Exploitation of Known Vulnerabilities
Purpose: Identify attempts to exploit known vulnerabilities for privilege escalation.
4.2. Monitoring for Misconfigured File or Folder Permissions
Purpose: Detect weak permissions on critical files or folders that may allow privilege escalation.
5. Credential Theft and Reuse
5.1. Detecting Use of Pass-the-Hash
Purpose: Identify the use of NTLM hashes for authentication, bypassing standard credentials.
5.2. Monitoring for Token Manipulation
Purpose: Detect attempts to manipulate tokens, such as by using tools like incognito
.
6. Exploit Local Privilege Escalation (LPE) Vulnerabilities
6.1. Detecting Execution of Exploits
Purpose: Identify the execution of known exploit tools for local privilege escalation.
6.2. Monitoring for Privilege Escalation via DLL Hijacking
Purpose: Detect attempts to use DLL hijacking for privilege escalation.
7. Abuse of Built-in Windows Tools
7.1. Detecting Use of WMI for Privilege Escalation
Purpose: Identify the use of Windows Management Instrumentation (WMI) for privilege escalation.
7.2. Monitoring for PowerShell Privilege Escalation Attempts
Purpose: Detect the use of PowerShell scripts or commands to escalate privileges.
8. Abuse of Service Control Manager
8.1. Detecting Service Installation by Non-Admins
Purpose: Identify attempts by non-administrative users to install services.
8.2. Monitoring for Unauthorized Service Modifications
Purpose: Detect modifications to existing services that could indicate privilege escalation.
9. Manipulation of Security Policies and Settings
9.1. Monitoring Changes to Local Security Policies
Purpose: Detect changes to local security policies that may indicate attempts to weaken security.
9.2. Detecting Changes to User Rights Assignments
Purpose: Identify changes to user rights assignments, which can indicate privilege escalation.
10. Manipulation of Active Directory Objects
10.1. Detecting Unusual Changes to Group Policy Objects (GPOs)
Purpose: Monitor for unauthorized changes to GPOs that could indicate privilege escalation.
10.2. Monitoring for Unusual Delegation of Privileges in AD
Purpose: Identify unusual delegation of privileges within Active Directory.
Last updated