Potential Process Injection via LD_PRELOAD Environment Variable

edit

Potential Process Injection via LD_PRELOAD Environment Variable

edit

This rule detects the execution of a process where the LD_PRELOAD environment variable is set. LD_PRELOAD can be used to inject a shared library into a binary at or prior to execution. A threat actor may do this in order to load a malicious shared library for the purposes of persistence, privilege escalation, and defense evasion. This activity is not common and will potentially indicate malicious or suspicious behavior.

Rule type: eql

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: Linux
  • Use Case: Threat Detection
  • Tactic: Defense Evasion
  • Tactic: Persistence
  • Tactic: Privilege Escalation

Version: 1

Rule authors:

  • Elastic

Rule license: Elastic License v2

Investigation guide

edit
## Setup
By default, the `Elastic Defend` integration does not collect environment variable logging. In order to capture this behavior, this rule requires a specific configuration option set within the advanced settings of the `Elastic Defend` integration.
```
Kibana -->
Fleet -->
Agent policies -->
Agent policy for which the option should be enabled -->
Name of the Elastic Defend integration -->
Show advanced settings -->
linux.advanced.capture_env_vars
```
`linux.advanced.capture_env_vars` should be set to `LD_PRELOAD,LD_LIBRARY_PATH`.
After saving the integration change, the Elastic Agents running this policy will be updated and the rule will function properly.

Rule query

edit
process where host.os.type == "linux" and
 event.action == "exec" and
 process.env_vars : ("LD_PRELOAD=?*", "LD_LIBRARY_PATH=?*")

Framework: MITRE ATT&CKTM