T1569

System Services

This detection identifies adversaries abusing Windows services, Linux systemd units, and macOS launchd daemons to execute malicious code. Attackers commonly leverage sc.exe, net start, PsExec, systemctl, and launchctl to create or start services that run attacker-controlled binaries. Indicators include services with suspicious binary paths (temp directories, user profile paths, UNC paths), service names mimicking legitimate system services, new service installations from unusual parent processes (cmd.exe, powershell.exe, wscript.exe), and service creations from non-standard accounts. This technique is frequently chained with lateral movement and persistence techniques to achieve remote code execution or maintain footholds across reboots.

Microsoft Sentinel / Defender
kusto
let SuspiciousPaths = dynamic(["\\Temp\\", "\\Users\\", "\\AppData\\", "\\ProgramData\\", "\\Downloads\\", "\\Public\\", "%TEMP%", "%APPDATA%"]);
let SuspiciousParents = dynamic(["cmd.exe", "powershell.exe", "pwsh.exe", "wscript.exe", "cscript.exe", "mshta.exe", "rundll32.exe", "regsvr32.exe", "msiexec.exe"]);
let LolBins = dynamic(["certutil.exe", "bitsadmin.exe", "wmic.exe", "mshta.exe", "regsvr32.exe", "rundll32.exe"]);
union
(
    // New service installations via Security event log
    SecurityEvent
    | where EventID == 7045
    | extend ServiceName = tostring(EventData.ServiceName),
             ServiceFileName = tostring(EventData.ImagePath),
             ServiceType = tostring(EventData.ServiceType),
             ServiceAccount = tostring(EventData.ServiceAccount)
    | where ServiceFileName has_any (SuspiciousPaths)
          or ServiceFileName matches regex @"\\\\[0-9]{1,3}\.[0-9]{1,3}\."  // UNC path
          or ServiceFileName has_any (LolBins)
          or ServiceAccount == "LocalSystem" and ServiceFileName has_any (SuspiciousPaths)
    | project TimeGenerated, Computer, EventID, ServiceName, ServiceFileName, ServiceType, ServiceAccount,
              SourceType = "SecurityEvent-7045"
),
(
    // sc.exe and net.exe service manipulation
    DeviceProcessEvents
    | where FileName in~ ("sc.exe", "net.exe", "net1.exe")
      and ProcessCommandLine has_any ("create", "start", "config", "binpath")
    | where InitiatingProcessFileName has_any (SuspiciousParents)
          or ProcessCommandLine matches regex @"binpath\s*=\s*[^\"]*\\(Temp|AppData|Downloads|Public|Users)\\"
          or ProcessCommandLine has "cmd.exe /c"
          or ProcessCommandLine has "powershell"
    | project TimeGenerated, DeviceName, AccountName, FileName, ProcessCommandLine,
              InitiatingProcessFileName, InitiatingProcessCommandLine,
              InitiatingProcessParentFileName, SourceType = "DeviceProcessEvents-sc"
),
(
    // PsExec-style remote service creation indicators
    DeviceProcessEvents
    | where FileName =~ "services.exe"
    | where InitiatingProcessFileName has_any ("psexec.exe", "psexec64.exe", "paexec.exe", "remcom.exe", "csexec.exe")
    | project TimeGenerated, DeviceName, AccountName, FileName, ProcessCommandLine,
              InitiatingProcessFileName, InitiatingProcessCommandLine, SourceType = "DeviceProcessEvents-psexec"
),
(
    // Suspicious service binaries created in temp paths
    DeviceFileEvents
    | where ActionType == "FileCreated"
    | where FolderPath has_any (SuspiciousPaths)
    | where FileName endswith ".exe" or FileName endswith ".dll"
    | join kind=inner (
        SecurityEvent
        | where EventID == 7045
        | extend ServiceFileName = tostring(EventData.ImagePath)
        | project ServiceFileName, ServiceName = tostring(EventData.ServiceName), ServiceInstallTime = TimeGenerated
    ) on $left.FolderPath == $right.ServiceFileName
    | project TimeGenerated, DeviceName, FileName, FolderPath, ServiceName, ServiceInstallTime, SourceType = "FileCreated-ServiceBinary"
)
| order by TimeGenerated desc
high severity medium confidence

Data Sources

Microsoft Defender for Endpoint Microsoft Sentinel Windows Security Events

Required Tables

SecurityEvent DeviceProcessEvents DeviceFileEvents

False Positives

  • IT automation tools (SCCM, Ansible, Chef) creating services during software deployment
  • Legitimate software installers that write binaries to AppData before creating services
  • Vulnerability scanners and EDR agents that enumerate or interact with the service control manager
  • Help desk remote management tools (TeamViewer, ConnectWise) that install services temporarily
  • Developer workstations running test services from non-standard paths during development

Unlock Pro Content

Get the full detection package for T1569 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections