Thanks to all of our ATT&CKcon participants. All sessions are here, and individual presentations will be posted soon.

Service Execution

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.

ID: T1035

Tactic: Execution

Platform:  Windows

Permissions Required:  Administrator, SYSTEM

Data Sources:  Windows Registry, Process monitoring, Process command-line parameters

Supports Remote:  Yes

Version: 1.0

Examples

NameDescription
BBSRAT

BBSRAT can start, stop, or delete services.[1]

Cobalt Strike

Cobalt Strike can use PsExec to execute a payload on a remote host. It can also use Service Control Manager to start new services.[2][3]

Honeybee

Honeybee launches a DLL file that gets executed as a service using svchost.exe[4]

Hydraq

Hydraq uses svchost.exe to execute a malicious DLL included in a new service group.[5]

Ke3chang

Ke3chang has used a tool known as RemoteExec (similar to PsExec) to remotely execute batch scripts and binaries.[6]

Koadic

Koadic can run a command on another machine using PsExec.[7]

Net

The net start and net stop commands can be used in Net to execute or stop Windows services.[8]

Net Crawler

Net Crawler uses PsExec to perform remote service manipulation to execute a copy of itself as part of lateral movement.[9]

Proxysvc

Proxysvc registers itself as a service on the victim’s machine to run as a standalone process.[10]

PsExec

Microsoft Sysinternals PsExec is a popular administration tool that can be used to execute binaries on remote systems using a temporary Windows service.[11]

Pupy

Pupy uses PsExec to execute a payload or commands on a remote host.[12]

RemoteCMD

RemoteCMD can execute commands remotely by creating a new service on the remote system.[13]

Shamoon

Shamoon creates a new service named "ntssrv" to execute the payload.[14]

Winexe

Winexe installs a service on the remote system, executes the command, then uninstalls the service.[15]

Wingbird

Wingbird uses services.exe to register a new autostart service named "Audit Service" using a copy of the local lsass.exe file.[16][17]

xCmd

xCmd can be used to execute binaries on remote systems by creating and starting a service.[18]

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 whitelisting [19] tools, like AppLocker, [20] [21] or Software Restriction Policies [22] where appropriate. [23]

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