Detection rules › Elastic

Suspicious XPC Service Child Process

Source
github.com/elastic/protections-artifacts

Detects an abnormal child process of a XPC service running from a suspicious location.

MITRE ATT&CK coverage

Rule body

[rule]
description = "Detects an abnormal child process of a XPC service running from a suspicious location."
id = "fdb36c69-9a1d-4ab3-863d-91b3301b6c6d"
license = "Elastic License v2"
name = "Suspicious XPC Service Child Process"
os_list = ["macos"]
reference = [
    "https://attack.mitre.org/techniques/T1559/003/",
    "https://attack.mitre.org/techniques/T1059/004/",
    "https://objective-see.org/blog/blog_0x59.html",
]
version = "1.0.27"

query = '''
process where event.type == "start" and process.parent.name : "com.*" and 
    ((process.name in ("bash", "sh", "zsh") and process.args == "-c") or
    process.name like~ ("curl", "nscurl", "osascript", "python*", "tclsh*")) and not
    process.executable like "/Applications/*" and not 
    process.parent.executable like~ 
                                ("/Applications/*", 
                                 "/Library/PrivilegedHelperTools/*", 
                                 "/System/*", 
                                 "/private/var/db/com.apple.xpc.*", 
                                 "/private/var/folders/*/*/*/AppTranslocation/*",
                                 "/Library/Application Support/AvastHUB/com.avast.hub.app/Contents/Helpers/com.avast.hub.worker",
                                 "/Library/Application Support/Symantec/Silo/MES/LiveUpdate/com.symantec.SymLUHelper",
                                 "/Library/Application Support/Symantec/Silo/NFM/LiveUpdate/com.symantec.SymLUHelper",
                                 "/Library/Application Support/AvastSecureLine/components/update/com.avast.osx.secureline.update-agent",
                                 "/Library/Application Support/CatoNetworks/com.catonetworks.mac.CatoClient.helper.app/Contents/MacOS/com.catonetworks.mac.CatoClient.helper",
                                 "/usr/libexec/*", 
                                 "/Library/SystemExtensions/*") and not 
    process.parent.name like~ ("com.docker.*", "com.todyl.SGNWatchDog") and not
    process.command_line like~ ("sh -c /bin/cp /Library/Preferences/SystemConfiguration/preferences.plist /Library/Preferences/SystemConfiguration/preferences.plist.old",
                               "/bin/sh -c git-upload-pack*", "*sh -c */Library/Application Support/HmaProVpn/hub/userinit.sh*") and 
    not process.Ext.effective_parent.executable == "/Library/Application Support/PasswordManager/com.trendmicro.consumer.pwmsvc" and
    not (process.parent.code_signature.trusted == true and process.parent.code_signature.exists == true) and
    not (
      process.parent.executable == "/Library/AppQuest/com.apple.questd" and
      process.Ext.effective_parent.executable == "/usr/bin/sudo"
    )
'''

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

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"


[[threat.technique]]
id = "T1559"
name = "Inter-Process Communication"
reference = "https://attack.mitre.org/techniques/T1559/"
[[threat.technique.subtechnique]]
id = "T1559.003"
name = "XPC Services"
reference = "https://attack.mitre.org/techniques/T1559/003/"



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

[internal]
min_endpoint_version = "8.11.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and process.parent.name : "com.*" and 
    ((process.name in ("bash", "sh", "zsh") and process.args == "-c") or
    process.name like~ ("curl", "nscurl", "osascript", "python*", "tclsh*")) and not
    process.executable like "/Applications/*" and not 
    process.parent.executable like~ 
                                ("/Applications/*", 
                                 "/Library/PrivilegedHelperTools/*", 
                                 "/System/*", 
                                 "/private/var/db/com.apple.xpc.*", 
                                 "/private/var/folders/*/*/*/AppTranslocation/*",
                                 "/Library/Application Support/AvastHUB/com.avast.hub.app/Contents/Helpers/com.avast.hub.worker",
                                 "/Library/Application Support/Symantec/Silo/MES/LiveUpdate/com.symantec.SymLUHelper",
                                 "/Library/Application Support/Symantec/Silo/NFM/LiveUpdate/com.symantec.SymLUHelper",
                                 "/Library/Application Support/AvastSecureLine/components/update/com.avast.osx.secureline.update-agent",
                                 "/Library/Application Support/CatoNetworks/com.catonetworks.mac.CatoClient.helper.app/Contents/MacOS/com.catonetworks.mac.CatoClient.helper",
                                 "/usr/libexec/*", 
                                 "/Library/SystemExtensions/*") and not 
    process.parent.name like~ ("com.docker.*", "com.todyl.SGNWatchDog") and not
    process.command_line like~ ("sh -c /bin/cp /Library/Preferences/SystemConfiguration/preferences.plist /Library/Preferences/SystemConfiguration/preferences.plist.old",
                               "/bin/sh -c git-upload-pack*", "*sh -c */Library/Application Support/HmaProVpn/hub/userinit.sh*") and 
    not process.Ext.effective_parent.executable == "/Library/Application Support/PasswordManager/com.trendmicro.consumer.pwmsvc" and
    not (process.parent.code_signature.trusted == true and process.parent.code_signature.exists == true) and
    not (
      process.parent.executable == "/Library/AppQuest/com.apple.questd" and
      process.Ext.effective_parent.executable == "/usr/bin/sudo"
    )

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.Ext.effective_parent.executableeq/usr/bin/sudoexcludes:process.Ext.effective_parent.executable field:"process.Ext.effective_parent.executable" value:"/usr/bin/sudo"
process.parent.executableeq/Library/AppQuest/com.apple.questdexcludes:process.parent.executable field:"process.parent.executable" value:"/Library/AppQuest/com.apple.questd"
process.parent.code_signature.existseqtrueexcludes:process.parent.code_signature.exists field:"process.parent.code_signature.exists" value:"true"
process.parent.code_signature.trustedeqtrueexcludes:process.parent.code_signature.trusted field:"process.parent.code_signature.trusted" value:"true"
process.Ext.effective_parent.executableeq/Library/Application Support/PasswordManager/com.trendmicro.consumer.pwmsvcexcludes:process.Ext.effective_parent.executable field:"process.Ext.effective_parent.executable" value:"/Library/Application Support/PasswordManager/com.trendmicro.consumer.pwmsvc"
process.command_linewildcardsh -c /bin/cp /Library/Preferences/SystemConfiguration/preferences.plist /Library/Preferences/SystemConfiguration/preferences.plist.old, /bin/sh -c git-upload-pack*, *sh -c */Library/Application Support/HmaProVpn/hub/userinit.sh*excludes:process.command_line field:"process.command_line" value:"sh -c /bin/cp /Library/Preferences/SystemConfiguration/preferences.plist /Library/Preferences/SystemConfiguration/preferences.plist.old" field:"process.command_line" value:"/bin/sh -c git-upload-pack*" field:"process.command_line" value:"*sh -c */Library/Application Support/HmaProVpn/hub/userinit.sh*"
process.executablestarts_with/Applications/excludes:process.executable field:"process.executable" value:"/Applications/"
process.parent.executablewildcard/Applications/*, /Library/PrivilegedHelperTools/*, /System/*, /private/var/db/com.apple.xpc.*, /private/var/folders/*/*/*/AppTranslocation/*, /Library/Application Support/AvastHUB/com.avast.hub.app/Contents/Helpers/com.avast.hub.worker, /Library/Application Support/Symantec/Silo/MES/LiveUpdate/com.symantec.SymLUHelper, /Library/Application Support/Symantec/Silo/NFM/LiveUpdate/com.symantec.SymLUHelper, /Library/Application Support/AvastSecureLine/components/update/com.avast.osx.secureline.update-agent, /Library/Application Support/CatoNetworks/com.catonetworks.mac.CatoClient.helper.app/Contents/MacOS/com.catonetworks.mac.CatoClient.helper, /usr/libexec/*, /Library/SystemExtensions/*excludes:process.parent.executable
process.parent.namewildcardcom.docker.*, com.todyl.SGNWatchDogexcludes:process.parent.name field:"process.parent.name" value:"com.docker.*" field:"process.parent.name" value:"com.todyl.SGNWatchDog"

Indicators

These rows show field, operator, and value matches.