IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.

Tor Process Execution

edit

Identifies execution of the Tor client on macOS. Tor routes traffic through a series of relays to conceal the origin of a connection. Adversaries use the tor process, including copies started from Terminal or via osascript, as a multi-hop proxy for command and control.

Rule type: eql

Rule indices:

  • logs-endpoint.events.process-*

Severity: medium

Risk score: 47

Runs every: 5m

Searches indices from: now-9m (Date Math format, see also Additional look-back time)

Maximum alerts per execution: 100

References:

Tags:

  • Domain: Endpoint
  • OS: macOS
  • Use Case: Threat Detection
  • Tactic: Command and Control
  • Data Source: Elastic Defend
  • Resources: Investigation Guide
  • Rule Type: Event Correlation (EQL)
  • Platform: macOS

Version: 1

Rule authors:

  • Elastic

Rule license: Elastic License v2

Investigation guide

edit

Triage and analysis

Investigating Tor Process Execution

Tor is a multi-hop proxy. On macOS the client is the tor process, whether it is the standalone daemon or the copy bundled with Tor Browser. Starting it from a shell, from Tor Browser, or by handing the command to Terminal with osascript -e 'tell application "Terminal" to do script "tor"' all result in this process start.

Possible investigation steps

  • Review process.executable, process.command_line, and process.args to see whether this is the Tor Browser bundle, a package-manager install such as Homebrew, or a copy from a temporary or user-writable directory.
  • Search the same host for the parent osascript command line when the parent chain includes Terminal, and for a follow-on network connection from tor shortly after the start.
  • Identify the user (process.user.name, user.name) and whether that account is expected to run Tor.
  • Review other alerts on the same host around this start for a preceding payload download or persistence item.

False positive analysis

  • Security testing that launches tor, including an AppleScript do script "tor" command, matches this rule. Exclude the specific test host or user rather than the process name.

Response and remediation

  • If the execution is not authorized, terminate the tor process and isolate the host.
  • Remove any unauthorized Tor Browser bundle or standalone tor binary, and any LaunchAgent or shell profile that starts it.
  • Review outbound connections from the process for command and control or data transfer.
  • Reset credentials for accounts that used the host while Tor was running, if follow-on malicious activity is found.

Setup

edit

Setup

This rule requires data coming in from Elastic Defend.

Elastic Defend Integration Setup

Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.

Prerequisite Requirements:

  • Fleet is required for Elastic Defend.
  • To configure Fleet Server refer to the documentation.

The following steps should be executed in order to add the Elastic Defend integration on a macOS System:

  • Go to the Kibana home page and click "Add integrations".
  • In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
  • Click "Add Elastic Defend".
  • Configure the integration name and optionally add a description.
  • Select the type of environment you want to protect, for MacOS it is recommended to select "Traditional Endpoints".
  • Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. Helper guide.
  • We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
  • Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead. For more details on Elastic Agent configuration settings, refer to the helper guide.
  • Click "Save and Continue".
  • To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts. For more details on Elastic Defend refer to the helper guide.

Rule query

edit
process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and
  process.name == "tor" and
  not process.Ext.effective_parent.executable == "/Applications/Tor Browser.app/Contents/MacOS/firefox"

Framework: MITRE ATT&CKTM