Service Execution

From enterprise
Jump to: navigation, search
Service Execution
Technique
ID T1035
Tactic Execution
Platform Windows
Permissions Required Administrator, SYSTEM
Data Sources Windows Registry, Process command-line parameters, Process monitoring
Supports Remote Yes

Adversaries may execute a binary, command, or script via a method that interacts with Windows services, such as the Service Control Manager. This can be done by either creating a new service or modifying an existing service. This technique is the execution used in conjunction with New Service and Modify Existing Service during service persistence or privilege escalation.

Examples

  • BBSRAT can start, stop, or delete services.1
  • Cobalt Strike can use PsExec to execute a payload on a remote host.2 It can also use Service Control Manager to start new services.3
  • Hydraq uses svchost.exe to execute a malicious DLL included in a new service group.4
  • Net Crawler uses PsExec to perform remote service manipulation to execute a copy of itself as part of lateral movement.5
  • The net start and net stop commands can be used in Net to execute or stop Windows services.6
  • Microsoft Sysinternals PsExec is a popular administration tool that can be used to execute binaries on remote systems using a temporary Windows service.7
  • Pupy uses PsExec to execute a payload or commands on a remote host.8
  • Shamoon creates a new service named “ntssrv” to execute the payload.9
  • installs a service on the remote system, executes the command, then uninstalls the service.10
  • Wingbird uses services.exe to register a new autostart service named "Audit Service" using a copy of the local lsass.exe file.1112
  • xCmd can be used to execute binaries on remote systems by creating and starting a service.13

Mitigation

Ensure that permissions disallow services that run at a higher permissions level from being created or interacted with by a user with a lower permission level. Also ensure that high permission level service binaries cannot be replaced or modified by users with a lower permission level.

Identify unnecessary system utilities or potentially malicious software that may be used to interact with Windows services, and audit and/or block them by using whitelisting14 tools, like AppLocker,1516 or Software Restriction Policies17 where appropriate.18

Detection

Changes to service Registry entries and command-line invocation of tools capable of modifying services that do not correlate with known software, patch cycles, etc., may be suspicious. If a service is used only to execute a binary or script and not to persist, then it will likely be changed back to its original form shortly after the service is restarted so the service is not left broken, as is the case with the common administrator tool PsExec.

References