T1559.003 Google Chronicle · YARA-L

Detect XPC Services in Google Chronicle

Adversaries may abuse macOS XPC (Cross-Process Communication) services to execute malicious code with elevated privileges. XPC services provide privilege separation between application components, with helper daemons running as root under launchd. Applications communicate with these daemons using the low-level XPC C API or the NSXPCConnection API. When XPC services fail to properly validate client identity (via audit token checks) or sanitize input parameters, adversaries can send crafted messages to execute arbitrary code in the context of the privileged daemon. This technique has been exploited in the wild via CVE-2021-30724 targeting Apple's CVMServer (com.apple.cvmsServ), and is frequently combined with T1068 (Exploitation for Privilege Escalation) to achieve root-level code execution from an unprivileged user context.

MITRE ATT&CK

Tactic
Execution
Technique
T1559 Inter-Process Communication
Sub-technique
T1559.003 XPC Services
Canonical reference
https://attack.mitre.org/techniques/T1559/003/

YARA-L Detection Query

Google Chronicle (YARA-L)
yaral
rule t1559_003_xpc_services_abuse {
  meta:
    author = "Detection Engineering"
    description = "Detects macOS XPC Services abuse (T1559.003): launchd spawning unexpected scripting interpreters indicative of XPC daemon exploitation, or unauthorized file creation and modification in XPC service and privileged helper directories."
    mitre_attack_tactic = "Execution"
    mitre_attack_technique = "T1559.003"
    mitre_attack_url = "https://attack.mitre.org/techniques/T1559/003/"
    severity = "HIGH"
    confidence = "MEDIUM"
    platform = "macOS"
    created = "2024-01-01"

  events:
    (
      $e1.metadata.event_type = "PROCESS_LAUNCH" and
      re.regex($e1.principal.process.file.full_path, `/(sbin/)?launchd$`) and
      re.regex($e1.target.process.file.full_path,
        `/(bash|sh|zsh|python3?|ruby|perl|osascript|curl|wget|ncat?|php)$`)
    )
    or
    (
      ($e1.metadata.event_type = "FILE_CREATION" or
       $e1.metadata.event_type = "FILE_MODIFICATION") and
      (
        re.regex($e1.target.file.full_path, `/Library/PrivilegedHelperTools/`) or
        re.regex($e1.target.file.full_path, `/Library/LaunchDaemons/`) or
        re.regex($e1.target.file.full_path, `XPCServices`)
      ) and
      re.regex($e1.target.file.full_path, `\.(plist|dylib|xpc)$`) and
      not re.regex($e1.principal.process.file.full_path,
        `(Installer|pkgd|softwareupdate|mdmclient|osinstallersetupd|jamf|santa|falcond)`)
    )

  condition:
    $e1
}
high severity medium confidence

Google Chronicle YARA-L 2.0 rule detecting T1559.003 XPC Services abuse on macOS using the Unified Data Model (UDM). The rule fires on two behavioral branches: (1) PROCESS_LAUNCH events where launchd (principal process) spawns a scripting interpreter as the target process, and (2) FILE_CREATION or FILE_MODIFICATION events targeting plist, dylib, or XPC bundle files in privileged helper or XPC service directories, initiated by processes outside the trusted installer set. Ingests macOS endpoint telemetry via Chronicle's data ingestion pipeline.

Data Sources

Google Chronicle SIEMmacOS endpoint telemetry via Chronicle ingestion (CrowdStrike Falcon, Carbon Black, Microsoft Defender for Endpoint forwarder, osquery via Chronicle agent)

Required Tables

UDM events with event_type PROCESS_LAUNCH, FILE_CREATION, FILE_MODIFICATION

False Positives & Tuning

  • Legitimate application autoupdate frameworks (Adobe Creative Cloud, Microsoft AutoUpdate, Dropbox) that write or replace XPC service bundles (.xpc) or LaunchDaemon plists during silent background updates using an updater process whose name does not match the exclusion regex
  • CI/CD self-hosted macOS build agents (GitHub Actions runner, CircleCI agent, Jenkins node) registered as launchd services that regularly invoke bash or sh to execute pipeline scripts during automated build and test workflows
  • macOS migration assistant and Time Machine restore operations that recreate LaunchDaemon plist files in /Library/LaunchDaemons/ using migration or backup restore binaries with non-standard process names not covered by the exclusion list
Download portable Sigma rule (.yml)

Other platforms for T1559.003


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1XPC Service and Privileged Helper Enumeration

    Expected signal: MDE DeviceProcessEvents: launchctl spawned multiple times with 'list' argument, parent = shell (bash/zsh). osquery process_events: launchctl and ls executions with enumeration arguments. File creation event for /tmp/df00tech_xpc_services.txt in MDE DeviceFileEvents and osquery file_events.

  2. Test 2Malicious LaunchDaemon XPC Service Registration

    Expected signal: MDE DeviceFileEvents: FileCreated for /Library/LaunchDaemons/com.df00tech.test.xpcservice.plist by the test process (InitiatingProcessFileName=cp or sudo). osquery file_events: target_path=/Library/LaunchDaemons/com.df00tech.test.xpcservice.plist, action=CREATED. MDE DeviceProcessEvents: launchd spawning /bin/sh with the touch/echo command. macOS Unified Log: launchd registering service label 'com.df00tech.test.xpcservice' and subsequent execution.

  3. Test 3Privileged Helper Tool Tampering Simulation

    Expected signal: MDE DeviceFileEvents: FileCreated action for /Library/PrivilegedHelperTools/com.df00tech.test.backdoor.helper, InitiatingProcessFileName=sudo or touch. osquery file_events: target_path=/Library/PrivilegedHelperTools/com.df00tech.test.backdoor.helper, action=CREATED, process_name=touch. macOS Unified Log: filesystem write event at the PrivilegedHelperTools path. codesign invocation captured in process events.

  4. Test 4XPC Client Connection Simulation via Python

    Expected signal: MDE DeviceProcessEvents: python3 spawned with inline script via shell. osquery process_events: python3 execution with cmdline containing 'subprocess', parent=bash/zsh. launchctl subprocess spawns visible as child process events. If this test is run from a launchd context (e.g., via a cron job registered with launchd), the 'launchd_spawned_interpreter' detection branch fires with python3 as the spawned interpreter.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections