-
Adam Pankow authored81d47bbd
Windows Privilege Escalation & Persistance
Rationale
Privilege escalation and maintaining persistence are among the many post-exploitation skills and tasks that attackers must grasp. Attackers and defenders need to understand how privilege escalation can occur and how persistence can be maintained on a system. This understanding allows attackers to move freely through a network, and allows defenders to prevent privilege escalation, detect attacker movement, and detect/prevent attacker persistence mechanisms.
Objectives
-
Identify and perform privilege escalation and integrity-level elevation
-
Familiarization with OS auditing and logging
-
Perform log cleaning and blending in
-
Identify aritfacts
Dll Search Order
Executables check the following locations:
-
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\KnownDLLs
-
The directory the the Application was run from
-
The directory specified in in the C+ function GetSystemDirectory()
-
The directory specified in the C+ function GetWindowsDirectory()
-
The current directory
DEMO: Additional Logging
-
Determine PS version (bunch of ways)
reg query hklm\software\microsoft\powershell\3\powershellengine\ powershell -command "$psversiontable"
-
Determine if logging is set (
PowerShell
andWMIC
)
reg query [hklm or hkcu]\software\policies\microsoft\windows\powershell reg query hklm\software\microsoft\wbem\cimom \| findstr /i logging # 0 = no | 1 = errors | 2 = verbose
WMIC Log Storage:
%systemroot%\system32\wbem\Logs\``
DEMO: Manipulating Logs and Files
-
Find FIles and Alter File attributes:
forfiles /P c:\windows\system32 /S /D +05/14/2019 wmic datafile where name='c:\\windows\\system32\\notepad.exe' get CreationDate, LastAccessed, LastModified copy /b filename.ext +,, $(Get-Item file.ext).lastaccesstime=$(date) |$(Get-Item test.txt).lastaccesstime=$(Get-Date "07/07/2004")
-
Clear Event Logs:
wevtutil clear-log Application Clear-Eventlog -Log Application, System