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
APT32

APT32's backdoor has used Windows services as a way to execute its malicious payload.[1]

BBSRAT

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

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.[3][4]

Empire

Empire can use PsExec to execute a payload on a remote host.[5]

FIN6

FIN6 has created Windows services to execute encoded PowerShell commands.[6]

Honeybee

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

HOPLIGHT

HOPLIGHT has used svchost.exe to execute a malicious DLL .[8]

Hydraq

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

Impacket

Impacket contains various modules emulating other service execution tools such as PsExec.[10]

Ke3chang

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

Koadic

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

Net

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

Net Crawler

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

NotPetya

NotPetya can use PsExec to help propagate itself across a network.[15][16]

Olympic Destroyer

Olympic Destroyer utilizes PsExec to help propagate itself across a network.[17]

PoshC2

PoshC2 contains an implementation of PsExec for remote execution.[18]

Proxysvc

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

PsExec

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

Pupy

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

RemoteCMD

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

Shamoon

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

Winexe

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

Wingbird

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

xCmd

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

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 [28] tools, like AppLocker, [29] [30] or Software Restriction Policies [31] where appropriate. [32]

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

  1. Dumont, R. (2019, March 20). Fake or Fake: Keeping up with OceanLotus decoys. Retrieved April 1, 2019.
  2. Lee, B. Grunzweig, J. (2015, December 22). BBSRAT Attacks Targeting Russian Organizations Linked to Roaming Tiger. Retrieved August 19, 2016.
  3. Strategic Cyber LLC. (2017, March 14). Cobalt Strike Manual. Retrieved May 24, 2017.
  4. Cobalt Strike. (2017, December 8). Tactics, Techniques, and Procedures. Retrieved December 20, 2017.
  5. Schroeder, W., Warner, J., Nelson, M. (n.d.). Github PowerShellEmpire. Retrieved April 28, 2016.
  6. McKeague, B. et al. (2019, April 5). Pick-Six: Intercepting a FIN6 Intrusion, an Actor Recently Tied to Ryuk and LockerGoga Ransomware. Retrieved April 17, 2019.
  7. Sherstobitoff, R. (2018, March 02). McAfee Uncovers Operation Honeybee, a Malicious Document Campaign Targeting Humanitarian Aid Groups. Retrieved May 16, 2018.
  8. US-CERT. (2019, April 10). MAR-10135536-8 – North Korean Trojan: HOPLIGHT. Retrieved April 19, 2019.
  9. Fitzgerald, P. (2010, January 26). How Trojan.Hydraq Stays On Your Computer. Retrieved February 22, 2018.
  10. SecureAuth. (n.d.). Retrieved January 15, 2019.
  11. Smallridge, R. (2018, March 10). APT15 is alive and strong: An analysis of RoyalCli and RoyalDNS. Retrieved April 4, 2018.
  12. Magius, J., et al. (2017, July 19). Koadic. Retrieved June 18, 2018.
  13. Savill, J. (1999, March 4). Net.exe reference. Retrieved September 22, 2015.
  14. Cylance. (2014, December). Operation Cleaver. Retrieved September 14, 2017.
  15. Chiu, A. (2016, June 27). New Ransomware Variant "Nyetya" Compromises Systems Worldwide. Retrieved March 26, 2019.
  16. US-CERT. (2017, July 1). Alert (TA17-181A): Petya Ransomware. Retrieved March 15, 2019.
  1. Mercer, W. and Rascagneres, P. (2018, February 12). Olympic Destroyer Takes Aim At Winter Olympics. Retrieved March 14, 2019.
  2. Nettitude. (2016, June 8). PoshC2: Powershell C2 Server and Implants. Retrieved April 23, 2019.
  3. Sherstobitoff, R., Malhotra, A. (2018, April 24). Analyzing Operation GhostSecret: Attack Seeks to Steal Data Worldwide. Retrieved May 16, 2018.
  4. Russinovich, M. (2014, May 2). Windows Sysinternals PsExec v2.11. Retrieved May 13, 2015.
  5. Nicolas Verdier. (n.d.). Retrieved January 29, 2018.
  6. Symantec Security Response. (2016, September 6). Buckeye cyberespionage group shifts gaze from US to Hong Kong. Retrieved September 26, 2016.
  7. Falcone, R.. (2016, November 30). Shamoon 2: Return of the Disttrack Wiper. Retrieved January 11, 2017.
  8. Prakash, T. (2017, June 21). Run commands on Windows system remotely using Winexe. Retrieved January 22, 2018.
  9. Anthe, C. et al. (2016, December 14). Microsoft Security Intelligence Report Volume 21. Retrieved November 27, 2017.
  10. Microsoft. (2017, November 9). Backdoor:Win32/Wingbird.A!dha. Retrieved November 27, 2017.
  11. Rayaprolu, A.. (2011, April 12). xCmd an Alternative to PsExec. Retrieved August 10, 2016.
  12. Beechey, J. (2010, December). Application Whitelisting: Panacea or Propaganda?. Retrieved November 18, 2014.
  13. Tomonaga, S. (2016, January 26). Windows Commands Abused by Attackers. Retrieved February 2, 2016.
  14. NSA Information Assurance Directorate. (2014, August). Application Whitelisting Using Microsoft AppLocker. Retrieved March 31, 2016.
  15. Corio, C., & Sayana, D. P. (2008, June). Application Lockdown with Software Restriction Policies. Retrieved November 18, 2014.
  16. Microsoft. (2012, June 27). Using Software Restriction Policies and AppLocker Policies. Retrieved April 7, 2016.