Query Details

Suspicious Oahd Activity On Mac OS

Query

# *Suspicious oahd Activity on macOS*

## Query Information

#### MITRE ATT&CK Technique(s)

| Technique ID | Title    | Link    |
| ---  | --- | --- |
| T1543.001 | Launch Agent | https://attack.mitre.org/techniques/T1543/001|


#### Description

This rule detects suspicious activities related to the 'oahd' process on macOS, which could indicate persistence mechanisms or execution of malicious code. It correlates file events (creation/modification of oahd-related files or plist manipulation) with subsequent process execution of 'oahd' outside its legitimate path, with suspicious parent processes, or with suspicious command-line arguments. Specifically, it looks for writes to the Rosetta Translation Cache, creation of a fake 'oahd' binary outside '/usr/libexec', manipulation of 'com.apple.oahd.plist' outside standard LaunchDaemon paths, and 'oahd' process execution from non-legitimate paths, with non-standard parent processes (not 'launchd' or 'xpcproxy'), or with command-line arguments pointing to suspicious locations like /tmp, /Users/Shared, /var/tmp, or containing URLs.

#### Author <Optional>
- **Name: Benjamin Zulliger**
- **Github: https://github.com/benscha/KQLAdvancedHunting**
- **LinkedIn: https://www.linkedin.com/in/benjamin-zulliger/**

#### Possible false positives
- Legitimate software updates or installations that temporarily write to unusual locations or modify system files in non-standard ways.
- Custom scripts or administrative tools that interact with 'oahd' or its related files for legitimate system management or debugging purposes.
- Development or testing environments where non-standard configurations or file paths are used for 'oahd' or related services.
- Rosetta 2 translation cache writes for legitimate applications, if the rule's logic for cache writes is too broad.

## Defender XDR
```KQL
let SuspiciousOahdFileEvents = 
	DeviceFileEvents
	| where
		// Writes in den Rosetta Translation Cache
		(FolderPath startswith "/var/db/oah/" and ActionType in ("FileCreated", "FileModified"))
		// Drop einer gefakten oahd-Binary ausserhalb des legitimen Pfads
		or (FileName =~ "oahd" and FolderPath !startswith "/usr/libexec")
		// Manipulation der LaunchDaemon plist
		or (FileName =~ "com.apple.oahd.plist"
			and FolderPath !in ("/System/Library/LaunchDaemons/", "/Library/LaunchDaemons/"))
	| extend
		IsCacheWrite = FolderPath startswith "/var/db/oah/",
		IsFakeBinary = FileName =~ "oahd" and FolderPath !startswith "/usr/libexec",
		IsPlistHijack = FileName =~ "com.apple.oahd.plist"
			and FolderPath !in ("/System/Library/LaunchDaemons/", "/Library/LaunchDaemons/")
	| project
		TimeGenerated,
		DeviceName,
		ActionType,
		FileName,
		FolderPath,
		InitiatingProcessFileName,
		InitiatingProcessFolderPath,
		InitiatingProcessCommandLine,
		InitiatingProcessAccountName,
		IsCacheWrite,
		IsFakeBinary,
		IsPlistHijack;
let SuspiciousOahdProcessEvents =
	DeviceProcessEvents
	| where FileName =~ "oahd"
		or ProcessCommandLine has "com.apple.oahd"
	| extend
		IsLegitPath = FolderPath startswith "/usr/libexec/oahd"
			or FolderPath =~ "/usr/libexec/oahd",
		IsSuspiciousParent = InitiatingProcessFileName !in~ ("launchd", "xpcproxy"),
		HasSuspiciousArgs = ProcessCommandLine has_any (
			"/tmp/", "/Users/Shared/", "/var/tmp/", "../", "http://", "https://"),
		IsSuspiciousCachePath = ProcessCommandLine has "/var/db/oah/"
			and not(ProcessCommandLine has "/var/db/oah/com.apple")
	| where not(IsLegitPath)
		or IsSuspiciousParent
		or HasSuspiciousArgs
		or IsSuspiciousCachePath
	| project
		TimeGenerated,
		DeviceName,
		FileName,
		FolderPath,
		ProcessCommandLine,
		InitiatingProcessFileName,
		InitiatingProcessFolderPath,
		InitiatingProcessCommandLine,
		AccountName,
		IsLegitPath,
		IsSuspiciousParent,
		HasSuspiciousArgs,
		IsSuspiciousCachePath;
// Korrelation: File-Event gefolgt von Process-Event auf demselben Device
SuspiciousOahdFileEvents
| join kind=inner (
	SuspiciousOahdProcessEvents
	| project-rename ProcessTime = TimeGenerated
) on DeviceName
| where ProcessTime between (TimeGenerated .. (TimeGenerated + 15m))
| project
	FileEventTime = TimeGenerated,
	ProcessEventTime = ProcessTime,
	DeviceName,
	// File-Side
	ActionType,
	AffectedFile = strcat(FolderPath, FileName),
	IsCacheWrite,
	IsFakeBinary,
	IsPlistHijack,
	FileInitiator = InitiatingProcessFileName,
	FileInitiatorPath = InitiatingProcessFolderPath,
	FileInitiatorCmdLine = InitiatingProcessCommandLine,
	DroppingAccountName = InitiatingProcessAccountName,
	// Process-Side
	SpawnedBinary = strcat(FolderPath1, FileName1),
	SpawnCmdLine = ProcessCommandLine,
	SpawnParent = InitiatingProcessFileName1,
	SpawnParentPath = InitiatingProcessFolderPath1,
	SpawnParentCmdLine = InitiatingProcessCommandLine1,
	SpawnAccountName = AccountName,
	// Flags
	IsLegitPath,
	IsSuspiciousParent,
	HasSuspiciousArgs,
	IsSuspiciousCachePath
| sort by FileEventTime desc
```

Explanation

This query is designed to detect suspicious activities related to the 'oahd' process on macOS, which might indicate malicious behavior or persistence mechanisms. Here's a simplified breakdown of what the query does:

  1. File Events Detection:

    • It looks for suspicious file activities related to 'oahd', such as:
      • Writing files in the Rosetta Translation Cache directory.
      • Creating a fake 'oahd' binary outside its legitimate path (/usr/libexec).
      • Manipulating the com.apple.oahd.plist file outside standard LaunchDaemon directories.
  2. Process Events Detection:

    • It monitors the execution of the 'oahd' process to identify:
      • Execution from non-legitimate paths.
      • Being started by suspicious parent processes (not launchd or xpcproxy).
      • Command-line arguments that point to suspicious locations or contain URLs.
  3. Correlation:

    • The query correlates file events with process events on the same device. It checks if a suspicious file event is followed by a suspicious process event within 15 minutes.
  4. Output:

    • The results include details about the file and process events, such as the time they occurred, the device name, file and process paths, command-line arguments, and flags indicating suspicious behavior.

Overall, this query helps identify potentially malicious activities involving the 'oahd' process on macOS by analyzing file and process events and looking for patterns that deviate from normal behavior.

Details

Benjamin Zulliger profile picture

Benjamin Zulliger

Released: June 19, 2026

Tables

DeviceFileEventsDeviceProcessEvents

Keywords

DeviceFileEventsProcessEventsFolderPathFileNameProcessCommandLineAccountName

Operators

letwherestartswithinor=~!startswith!inextendprojectjoinkind=innerproject-renamebetweenstrcatsort by

Actions