Windows
CVE
https://github.com/MzHmO/Exploit-Street
SeImpersonate
TL/DR
Use DeadPotato rigth now
Use Sweet Potato to rule them all - Sweet Potato
If you do not want to use Sweet Potato:
If the machine is >= Windows 10 1809 & Windows Server 2019 - Try Rogue Potato
If the machine is < Windows 10 1809 < Windows Server 2019 - Try Juicy Potato
Service Binary Hijacking
When using a network logon such as WinRM or a bind shell, Get-CimInstance and Get-Service will result in a "permission denied" error when querying for services with a non-administrative user. Using an interactive logon such as RDP solves this problem.
Get a list of all installed Windows services
Get-CimInstance -ClassName win32_service | Select Name,State,PathName | Where-Object {$_.State -like 'Running'}The icacls.exe utility outputs the corresponding principals and their permission mask. The most relevant permissions and their masks are listed below:
F
Full access
M
Modify access
RX
Read and execute access
R
Read-only access
W
Write-only access
In order to execute the binary through the service, we need to restart it. We can use the net stop command to stop the service.
If we do not have permission to manually restart the service, we must consider another approach. If the service Startup Type is set to "Automatic", we may be able to restart the service by rebooting the machine.
Check StartMode:
In order to issue a reboot, our user needs to have the privilege SeShutDownPrivilege assigned
Using PowerUp.ps1
Get Modifiable services and abuse:
Service DLL Hijacking
The following listing shows the standard search order
Find process with missing dll
use procmon from sysinternals to check for missing dlls (โNAME NOT FOUNDโ)
Make sure you have enough rights to write your dll to this directory
Build malicious DLL
The provided comments from Microsoft state that DLL_PROCESS_ATTACH is used when a process is loading the DLL. Since the target service binary process in our example tries to load the DLL, this is the case we need to add our code to.
revshell
To fix build problems sudo apt install mingw-w64
Deliver dll and trigger its load
Unquoted Service Paths
When Windows starts the service, it will use the following order to try to start the executable file due to the spaces in the path and lack of quotes.
Enumerate running and stopped services
it shows a stopped service named GammaService. The unquoted service binary path contains multiple spaces and is therefore potentially vulnerable to this attack vector
Let's enter this command in cmd.exe instead of PowerShell to avoid escaping issues for the quote in the second findstr command. Alternatively, we could use Select-String in PowerShell.
The output of this command only lists services that are potentially vulnerable to our attack vector, such as GammaService.
check if we can start and stop the identified service as steve with Start-Service and Stop-Service.
Next, let's list the paths Windows uses to attempt locating the executable file of the service.
Deliver your binary to one of this paths and restart the service
Using PowerUp.ps1
Scheduled Tasks
Show scheduled tasks:
Check permissions on file from scheduled task:
UAC Bypass
To perform manual enumeration and identify whether a Windows workstation has enabled UAC, you can use the following command from a command prompt:
Tool Enumeration
To run the SharpUp tool and perform an enumeration if the UAC feature is enabled, you can execute the following command with appropriate argument:
PS history
BSOD
Last updated