Sc.exe

Used by Windows to manage services

Paths

  • C:\Windows\System32\sc.exe
  • C:\Windows\SysWOW64\sc.exe

Commands

ADS

Creates a new service and executes the file stored in the ADS.

Use case: Execute binary file hidden inside an alternate data stream

Privileges: User

sc create evilservice binPath="\"c:\\ADS\\file.txt:cmd.exe\" /c echo works > \"c:\ADS\works.txt\"" DisplayName= "evilservice" start= auto\ & sc start evilservice

ADS

Modifies an existing service and executes the file stored in the ADS.

Use case: Execute binary file hidden inside an alternate data stream

Privileges: User

sc config {ExistingServiceName} binPath="\"c:\\ADS\\file.txt:cmd.exe\" /c echo works > \"c:\ADS\works.txt\"" & sc start {ExistingServiceName}

Detection

Resources