Privilege Escalation (TA0004) Techniques
Introduction
Investigating privilege escalation incidents forensically on workstations and server systems is critical in identifying how an attacker or malicious user gained elevated access. Privilege escalation can occur in various ways, such as exploiting system vulnerabilities, misconfigurations, or leveraging stolen credentials.
Understanding Privilege Escalation
Vertical Escalation: Attacker gains higher-level privileges (e.g., regular user to administrator).
Horizontal Escalation: Attacker expands access across accounts at the same privilege level.
Common Techniques: Exploiting vulnerabilities, password cracking, manipulating user accounts, token manipulation, etc.
Data Collection and Preservation
Forensic Imaging: Create forensic images of affected systems using tools like FTK Imager or dd.
Memory Capture: Use tools like WinPmem or Magnet RAM Capture to capture live memory.
Log Collection: Collect relevant logs, including security logs, system logs, application logs, and audit logs.
Initial Analysis and Identification
Security Logs Analysis: Look for anomalous login activities, especially Event IDs 4624 (successful login), 4625 (failed login), and 4672 (special privileges assigned).
Account Review: Examine user accounts for unauthorised creation, modification, or elevation of privileges.
System and Application Logs: Check for logs indicating changes in system settings or application configurations that could lead to privilege escalation.
In-Depth Investigation
Vulnerability Exploitation: Identify if any known vulnerabilities have been exploited for privilege escalation. Tools like Nessus or OpenVAS can help retrospectively identify vulnerabilities.
Group Policy Analysis: Review group policies for misconfigurations that may have allowed privilege escalation.
File and Registry Analysis: Look for unauthorised modifications in critical system files and registry entries that could indicate privilege changes.
Artifact Analysis
Windows Registry: Investigate keys related to user accounts and privileges.
Event Tracing Logs: Examine ETL files for evidence of privilege escalation activities.
Scheduled Tasks: Check for any scheduled tasks created or modified by unauthorised users.
Service Configuration: Analyse services to see if any have been modified to run with higher privileges.
Network Analysis (if applicable)
Analyse network traffic for signs of lateral movement or external communications that might be related to the privilege escalation.
Use of Specialised Forensic Tools
Forensic Suites: Tools like EnCase, X-Ways Forensics, or Autopsy for comprehensive analysis.
Windows-specific Tools: Windows Event Viewer, Sysinternals Suite, AccessChk, and Process Monitor.
Documentation and Reporting
Detailed Documentation: Document every step, including tools used, findings, and methodologies.
Forensic Report: Prepare a comprehensive report detailing the privilege escalation incident and its impact.
Post-Investigation Actions
Remediation and Mitigation: Implement necessary fixes, security updates, and policy changes.
Recovery: Restore systems and data from backups if necessary.
Lessons Learned: Conduct a review to improve security posture and response strategies.
Key Considerations
Legal and Compliance: Ensure all investigative actions comply with legal and organisational guidelines.
Chain of Custody: Maintain a clear chain of custody for all forensic evidence.
Confidentiality and Integrity: Handle all data securely and maintain its integrity.
Each privilege escalation incident is unique and might require a customised approach. Tailor the investigation to the specifics of the case and the environment in which you are operating.
Using KQL to Investigate Privilege Escalation Activities in an Environment Using Defender/Sentinel
Privilege Escalation techniques allow adversaries to gain higher-level permissions on a system. These elevated privileges may be used to execute malicious actions, access sensitive data, or move laterally across the network.
1. T1055 - Process Injection
Objective: Detect attempts to inject code into the address space of another process to gain elevated privileges or evade detection.
Detect Remote Thread Injection
Purpose: Identify remote thread injection attempts used for privilege escalation.
Monitor for DLL Injection Techniques
Purpose: Detect DLL injection techniques that may be used to gain elevated privileges.
Identify Process Hollowing Attempts
Purpose: Monitor for process hollowing attempts where the memory of a legitimate process is replaced with malicious code.
Detect APC Injection
Purpose: Identify APC (Asynchronous Procedure Call) injection used for executing code in the context of another process.
Monitor for PowerShell Injection Attempts
Purpose: Detect PowerShell commands attempting process injection for privilege escalation.
Identify Shellcode Injection
Purpose: Monitor for shellcode injection techniques.
Detect Process Doppelgänging
Purpose: Identify process doppelgänging techniques that exploit NTFS transactions.
Monitor for Windows API Calls Related to Injection
Purpose: Detect Windows API calls commonly used in process injection techniques.
Identify Process Injection via Code Cavitation
Purpose: Monitor for code cavitation, where code is injected into a remote process using lesser-known API functions.
Detect Hijacking of Process Execution
Purpose: Identify the use of Image File Execution Options (IFEO) to hijack process execution for privilege escalation.
2. T1543 - Create or Modify System Process
Objective: Detect the creation or modification of system processes (e.g., services, daemons) to gain elevated privileges.
Detect New Service Creation with Elevated Privileges
Purpose: Identify the creation of new services running with elevated privileges.
Monitor for Modifications to Existing Services
Purpose: Detect modifications to existing services that may be used for privilege escalation.
Identify Services Configured to Auto Start
Purpose: Monitor for services configured to start automatically, potentially providing persistence with elevated privileges.
Detect Services Executing Suspicious Commands
Purpose: Identify services executing commands commonly used for malicious activities.
Monitor for Services Running from Non-Standard Locations
Purpose: Detect services running executables from unusual or non-standard locations, which may indicate privilege escalation.
Identify Suspicious Service Names or Descriptions
Purpose: Monitor for services with suspicious names or descriptions that may indicate malicious intent.
Detect Service Installation by Non-Admin Accounts
Purpose: Identify services installed by non-administrative accounts.
Monitor for Service Execution Using System Accounts
Purpose: Detect services installed with the SYSTEM account, potentially indicating an attempt to gain SYSTEM-level privileges.
Identify Unusual Service Start Types
Purpose: Monitor for services with unusual start types that may indicate malicious persistence mechanisms.
Detect Services Associated with Common Attack Tools
Purpose: Identify services installed with commands associated with common attack tools.
3. T1068 - Exploitation for Privilege Escalation
Objective: Detect the exploitation of vulnerabilities that allow an adversary to escalate privileges.
Detect Known Exploits for Privilege Escalation
Purpose: Identify attempts to exploit known vulnerabilities for privilege escalation.
Monitor for Exploit-Related Processes
Purpose: Detect processes related to exploitation activities.
Identify Unusual Kernel Driver Loads
Purpose: Monitor for the loading of kernel drivers associated with exploitation.
Detect PowerShell Execution of Exploit Code
Purpose: Identify PowerShell commands executing exploit code.
Monitor for Privilege Escalation via Exploited Services
Purpose: Detect modifications to services that may indicate privilege escalation through exploitation.
Identify Exploit Attempts Targeting System Processes
Purpose: Monitor for exploit attempts targeting critical system processes.
Detect Use of Exploitation Frameworks
Purpose: Identify the use of exploitation frameworks commonly used for privilege escalation.
Monitor for Malicious Use of Debugging Tools
Purpose: Detect the use of debugging tools that may be used to exploit vulnerabilities.
Identify Vulnerability Scanners Running on High Privileged Accounts
Purpose: Monitor for vulnerability scanners running with elevated privileges, potentially used to identify exploitable vulnerabilities.
Detect Attempts to Exploit Privilege Escalation Vulnerabilities via Scripts
Purpose: Identify scripts attempting to exploit privilege escalation vulnerabilities.
4. T1548 - Abuse Elevation Control Mechanism
Objective: Detect abuse of elevation control mechanisms (e.g., UAC bypass) to gain elevated privileges.
Detect UAC Bypass via Fodhelper
Purpose: Identify attempts to bypass User Account Control (UAC) using Fodhelper.
Monitor for UAC Bypass via Event Viewer
Purpose: Detect UAC bypass attempts using the Event Viewer.
Identify UAC Bypass via ComputerDefaults
Purpose: Monitor for UAC bypass attempts using ComputerDefaults.
Detect UAC Bypass via SilentCleanup
Purpose: Identify UAC bypass attempts using the SilentCleanup task.
Monitor for UAC Bypass via sdclt.exe
Purpose: Detect UAC bypass attempts using sdclt.exe.
Identify UAC Bypass via Registry Key Modification
Purpose: Monitor for registry key modifications used in UAC bypass attacks.
Detect UAC Bypass via wscript.exe
Purpose: Identify UAC bypass attempts using wscript.exe.
Monitor for UAC Bypass via DllHost.exe
Purpose: Detect UAC bypass attempts using DllHost.exe.
Identify UAC Bypass via Sysprep
Purpose: Monitor for UAC bypass attempts using the Sysprep tool.
Detect UAC Bypass via Task Scheduler
Purpose: Identify UAC bypass attempts using the Task Scheduler with elevated privileges.
5. T1134 - Access Token Manipulation
Objective: Detect manipulation of access tokens to impersonate other users or escalate privileges.
Detect Token Impersonation Attempts
Purpose: Identify attempts to impersonate another user's token.
Monitor for Use of Mimikatz to Steal Tokens
Purpose: Detect the use of Mimikatz to steal tokens for privilege escalation.
Identify Process Privilege Elevation via Token Duplication
Purpose: Monitor for token duplication attempts that may indicate privilege escalation.
Detect Manipulation of Tokens via PowerShell
Purpose: Identify PowerShell commands attempting token manipulation.
Monitor for Token Privileges Adjustments
Purpose: Detect adjustments to token privileges that may be used to gain elevated access.
Identify Token Manipulation Using WinAPI Calls
Purpose: Monitor for attempts to manipulate access tokens using Windows API calls.
Detect Token Manipulation by Non-Admin Accounts
Purpose: Identify token manipulation attempts by non-administrative users.
Monitor for Process Creation Using Stolen Tokens
Purpose: Detect the creation of processes using stolen or duplicated tokens.
Identify Suspicious Token Privilege Enabling
Purpose: Monitor for suspicious enabling of token privileges that may indicate an attempt to escalate privileges.
Detect Token Manipulation Using Third-Party Tools
Purpose: Identify token manipulation attempts using third-party tools.
6. T1078 - Valid Accounts
Objective: Detect the use of valid accounts to gain elevated privileges.
Detect Use of Default or Well-Known Accounts
Purpose: Identify logons using default or well-known accounts that may be used for privilege escalation.
Monitor for Unusual Account Activity by Admin Users
Purpose: Detect unusual activity by accounts with administrative privileges.
Identify Logons Using Service Accounts
Purpose: Monitor for logons using service accounts that may indicate privilege escalation.
Detect Lateral Movement Using Valid Accounts
Purpose: Identify lateral movement attempts using valid accounts.
Monitor for Logon Attempts by Non-Privileged Accounts
Purpose: Detect logon attempts by non-privileged accounts that may be attempting privilege escalation.
Identify Attempted Use of Disabled or Expired Accounts
Purpose: Monitor for attempts to use disabled or expired accounts.
Detect Suspicious Use of Local Administrator Accounts
Purpose: Identify suspicious logon attempts using local Administrator accounts.
Monitor for Account Usage Outside of Normal Hours
Purpose: Detect account usage outside of normal business hours that may indicate privilege escalation.
Identify Use of Stolen Credentials
Purpose: Monitor for failed logon attempts that may indicate the use of stolen credentials.
Detect Use of Valid Accounts by Non-Standard Processes
Purpose: Identify use of valid accounts by processes that are not typically associated with administrative tasks.
7. T1547 - Boot or Logon Autostart Execution
Objective: Detect mechanisms that automatically execute code with elevated privileges upon boot or user logon.
Detect Modifications to Registry Run Keys
Purpose: Identify changes to registry keys that execute programs at startup, which may be used for privilege escalation.
Monitor for New Entries in the Startup Folder
Purpose: Detect new files added to the Startup folder that may be used to execute code with elevated privileges.
Identify Modifications to Winlogon Keys
Purpose: Monitor for changes to Winlogon keys that may indicate privilege escalation attempts.
Detect Creation of New Services Set to Auto Start
Purpose: Identify the creation of new services configured to start automatically, potentially providing elevated privileges.
Monitor for New Logon Scripts
Purpose: Detect the creation of new logon scripts that may be used for privilege escalation.
Identify Modifications to the Shell Registry Key
Purpose: Monitor for changes to the Shell registry key that can be used to persist elevated privileges.
Detect New DLLs Added to Startup Folders
Purpose: Identify DLL files added to startup folders for privilege escalation.
Monitor for Creation of WMI Event Subscriptions
Purpose: Detect the creation of WMI event subscriptions that can be used for persistent privilege escalation.
Identify Modifications to the Userinit Key
Purpose: Monitor for changes to the Userinit registry key, which can be used to launch programs with elevated privileges at logon.
Detect Creation of Hidden Scheduled Tasks
Purpose: Identify the creation of hidden or system-level scheduled tasks that may be used to persist elevated privileges.
8. T1055.001 - Dynamic-link Library Injection
Objective: Detect DLL injection techniques used to execute code in the context of another process, potentially with elevated privileges.
Detect DLL Injection Using LoadLibrary
Purpose: Identify the use of the LoadLibrary API for DLL injection.
Monitor for DLL Injection Using CreateRemoteThread
Purpose: Detect attempts to inject DLLs using the CreateRemoteThread API.
Identify DLL Injection via NtMapViewOfSection
Purpose: Monitor for DLL injection attempts using the NtMapViewOfSection API.
Detect DLL Injection via AppInit_DLLs
Purpose: Identify modifications to the AppInit_DLLs registry key, which can be used for DLL injection.
Monitor for DLL Injection via SetWindowsHookEx
Purpose: Detect attempts to inject DLLs using the SetWindowsHookEx API.
Identify DLL Injection via RtlCreateUserThread
Purpose: Monitor for DLL injection attempts using the RtlCreateUserThread API.
Detect DLL Injection Using CreateProcessWithTokenW
Purpose: Identify DLL injection attempts using the CreateProcessWithTokenW API.
Monitor for DLL Injection via Code Cavitation
Purpose: Detect code cavitation techniques where DLLs are injected using lesser-known API functions.
Identify DLL Injection via Process Hollowing
Purpose: Monitor for DLL injection attempts using process hollowing techniques.
Detect DLL Injection via Malicious Services
Purpose: Identify DLL injection attempts via malicious services.
Last updated