Modification of Environment Variable via Launchctl

edit

Modification of Environment Variable via Launchctl

edit

Identifies modifications to an environment variable using the built-in launchctl command. Adversaries may execute their own malicious payloads by hijacking certain environment variables to load arbitrary libraries or bypass certain restrictions.

Rule type: query

Rule indices:

  • logs-endpoint.events.*

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: Defense Evasion
  • Data Source: Elastic Defend

Version: 105

Rule authors:

  • Elastic

Rule license: Elastic License v2

Rule query

edit
event.category:process and host.os.type:macos and event.type:start and
  process.name:launchctl and
  process.args:(setenv and not (ANT_HOME or
                                DBUS_LAUNCHD_SESSION_BUS_SOCKET or
                                EDEN_ENV or
                                LG_WEBOS_TV_SDK_HOME or
                                RUNTIME_JAVA_HOME or
                                WEBOS_CLI_TV or
                                JAVA*_HOME) and
                not *.vmoptions) and
  not process.parent.executable:("/Applications/IntelliJ IDEA CE.app/Contents/jbr/Contents/Home/lib/jspawnhelper" or
                                  /Applications/NoMachine.app/Contents/Frameworks/bin/nxserver.bin or
                                  /Applications/NoMachine.app/Contents/Frameworks/bin/nxserver.bin or
                                  /usr/local/bin/kr)

Framework: MITRE ATT&CKTM