Detection rules › Elastic

Service Installed by an Unusual Microsoft Signed Process

Source
github.com/elastic/protections-artifacts

Identifies the install of a new service by an unusual Microsoft signed program or an executable from a world user writable path. Adversaries may use this technique to maintain persistence or run with System privileges.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the install of a new service by an unusual Microsoft signed program or an executable from a world user
writable path. Adversaries may use this technique to maintain persistence or run with System privileges.
"""
id = "07f2c66e-46e3-4ce2-aca1-291172fc88fc"
license = "Elastic License v2"
name = "Service Installed by an Unusual Microsoft Signed Process"
os_list = ["windows"]
version = "1.0.3"

query = '''
any where event.category == "configuration" and event.action == "service_installed" and user.id != "S-1-5-18" and
  process.code_signature.subject_name == "Microsoft Windows" and
  not winlog.event_data.ServiceStartType in ("Manual", "Disabled") and
  not process.executable : ("?:\\Windows\\Sys?????\\sc.exe",
                             "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\setup.exe",
                             "C:\\Windows\\Microsoft.NET\\Framework\\v*\\InstallUtil.exe",
                             "C:\\Program Files\\Microsoft SQL Server\\*\\ScenarioEngine.exe",
                             "C:\\Windows\\System32\\wsmprovhost.exe",
                             "C:\\Windows\\Sys?????\\msiexec.exe",
                             "C:\\Program Files\\Microsoft\\AzureAttestService\\AzureAttestServiceInstaller.exe",
                             "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell_ise.exe",
                             "C:\\Program Files\\Common Files\\microsoft shared\\ClickToRun\\OfficeClickToRun.exe",
                             "C:\\Program Files\\Microsoft Office\\root\\Integration\\Addons\\OneDriveSetup.exe",
                             "C:\\Program Files (x86)\\AOMEI Cyber Backup\\x64\\InstallUtil.exe",
                             "C:\\Windows\\Microsoft.NET\\Framework64\\*\\InstallUtil.exe",
                             "C:\\Program Files (x86)\\AOMEI Cyber Backup\\x64\\iscsi\\InstallUtil.exe",
                             "C:\\Program Files (x86)\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe") and
   not (process.parent.executable : ("C:\\Windows\\Sys?????\\msiexec.exe", "C:\\Program Files\\Wireshark\\USBPcapSetup-*.exe", "C:\\Program Files (x86)\\AOMEI Cyber Backup\\x64\\AOMEIImgService.exe") and
        process.executable : "?:\\Windows\\Sys?????\\rundll32.exe") and
   not process.parent.executable : ("F:\\setup.exe") and
   not process.command_line : ("\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" ",
                               "\"C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -ExecutionPolicy UnRestricted -File *") and 
   not (process.executable : "?:\\Windows\\System32\\dllhost.exe" and
        process.command_line :  "C:\\Windows\\system32\\dllhost.exe /Processid:{02D4B3F1-FD88-11D1-960D-00805FC79235}" and
        process.parent.executable : "C:\\Windows\\System32\\services.exe")
'''

min_endpoint_version = "9.0.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"
[[threat.technique.subtechnique]]
id = "T1543.003"
name = "Windows Service"
reference = "https://attack.mitre.org/techniques/T1543/003/"



[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

[internal]
min_endpoint_version = "9.0.0"

Stages and Predicates

Stage 1: any

any where event.category == "configuration" and event.action == "service_installed" and user.id != "S-1-5-18" and
  process.code_signature.subject_name == "Microsoft Windows" and
  not winlog.event_data.ServiceStartType in ("Manual", "Disabled") and
  not process.executable : ("?:\\Windows\\Sys?????\\sc.exe",
                             "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\setup.exe",
                             "C:\\Windows\\Microsoft.NET\\Framework\\v*\\InstallUtil.exe",
                             "C:\\Program Files\\Microsoft SQL Server\\*\\ScenarioEngine.exe",
                             "C:\\Windows\\System32\\wsmprovhost.exe",
                             "C:\\Windows\\Sys?????\\msiexec.exe",
                             "C:\\Program Files\\Microsoft\\AzureAttestService\\AzureAttestServiceInstaller.exe",
                             "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell_ise.exe",
                             "C:\\Program Files\\Common Files\\microsoft shared\\ClickToRun\\OfficeClickToRun.exe",
                             "C:\\Program Files\\Microsoft Office\\root\\Integration\\Addons\\OneDriveSetup.exe",
                             "C:\\Program Files (x86)\\AOMEI Cyber Backup\\x64\\InstallUtil.exe",
                             "C:\\Windows\\Microsoft.NET\\Framework64\\*\\InstallUtil.exe",
                             "C:\\Program Files (x86)\\AOMEI Cyber Backup\\x64\\iscsi\\InstallUtil.exe",
                             "C:\\Program Files (x86)\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe") and
   not (process.parent.executable : ("C:\\Windows\\Sys?????\\msiexec.exe", "C:\\Program Files\\Wireshark\\USBPcapSetup-*.exe", "C:\\Program Files (x86)\\AOMEI Cyber Backup\\x64\\AOMEIImgService.exe") and
        process.executable : "?:\\Windows\\Sys?????\\rundll32.exe") and
   not process.parent.executable : ("F:\\setup.exe") and
   not process.command_line : ("\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" ",
                               "\"C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -ExecutionPolicy UnRestricted -File *") and 
   not (process.executable : "?:\\Windows\\System32\\dllhost.exe" and
        process.command_line :  "C:\\Windows\\system32\\dllhost.exe /Processid:{02D4B3F1-FD88-11D1-960D-00805FC79235}" and
        process.parent.executable : "C:\\Windows\\System32\\services.exe")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.command_lineeqC:\Windows\system32\dllhost.exe /Processid:{02D4B3F1-FD88-11D1-960D-00805FC79235}excludes:process.command_line field:"process.command_line" value:"C:\Windows\system32\dllhost.exe /Processid:{02D4B3F1-FD88-11D1-960D-00805FC79235}"
process.executableeq?:\Windows\System32\dllhost.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\dllhost.exe"
process.parent.executableeqC:\Windows\System32\services.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\services.exe"
process.executableeq?:\Windows\Sys?????\rundll32.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\Sys?????\rundll32.exe"
process.parent.executablewildcardC:\Windows\Sys?????\msiexec.exe, C:\Program Files\Wireshark\USBPcapSetup-*.exe, C:\Program Files (x86)\AOMEI Cyber Backup\x64\AOMEIImgService.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\Sys?????\msiexec.exe" field:"process.parent.executable" value:"C:\Program Files\Wireshark\USBPcapSetup-*.exe" field:"process.parent.executable" value:"C:\Program Files (x86)\AOMEI Cyber Backup\x64\AOMEIImgService.exe"
process.command_linewildcard"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" , "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy UnRestricted -File *excludes:process.command_line
process.executablewildcard?:\Windows\Sys?????\sc.exe, C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe, C:\Windows\Microsoft.NET\Framework\v*\InstallUtil.exe, C:\Program Files\Microsoft SQL Server\*\ScenarioEngine.exe, C:\Windows\System32\wsmprovhost.exe, C:\Windows\Sys?????\msiexec.exe, C:\Program Files\Microsoft\AzureAttestService\AzureAttestServiceInstaller.exe, C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe, C:\Program Files\Common Files\microsoft shared\ClickToRun\OfficeClickToRun.exe, C:\Program Files\Microsoft Office\root\Integration\Addons\OneDriveSetup.exe, C:\Program Files (x86)\AOMEI Cyber Backup\x64\InstallUtil.exe, C:\Windows\Microsoft.NET\Framework64\*\InstallUtil.exe, C:\Program Files (x86)\AOMEI Cyber Backup\x64\iscsi\InstallUtil.exe, C:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exeexcludes:process.executable
process.parent.executableeqF:\setup.exeexcludes:process.parent.executable field:"process.parent.executable" value:"F:\setup.exe"
winlog.event_data.ServiceStartTypeinDisabled, Manualexcludes:winlog.event_data.ServiceStartType field:"winlog.event_data.ServiceStartType" value:"Disabled" field:"winlog.event_data.ServiceStartType" value:"Manual"

Indicators

These rows show field, operator, and value matches.