PsExec Network Connection

edit

Identifies use of the SysInternals tool PsExec.exe making a network connection. This could be an indication of lateral movement.

Rule type: eql

Rule indices:

  • winlogbeat-*
  • logs-endpoint.events.*
  • logs-windows.*

Severity: low

Risk score: 21

Runs every: 5 minutes

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

Maximum alerts per execution: 100

Tags:

  • Elastic
  • Host
  • Windows
  • Threat Detection
  • Execution
  • Investigation Guide

Version: 102 (version history)

Added (Elastic Stack release): 7.6.0

Last modified (Elastic Stack release): 8.6.0

Rule authors: Elastic

Rule license: Elastic License v2

Potential false positives

edit

PsExec is a dual-use tool that can be used for benign or malicious activity. It’s important to baseline your environment to determine the amount of noise to expect from this tool.

Investigation guide

edit
## Triage and analysis

### Investigating PsExec Network Connection

PsExec is a remote administration tool that enables the execution of commands with both regular and SYSTEM privileges
on Windows systems. Microsoft develops it as part of the Sysinternals Suite. Although commonly used by administrators,
PsExec is frequently used by attackers to enable lateral movement and execute commands as SYSTEM to disable defenses and
bypass security protections.

This rule identifies PsExec execution by looking for the creation of `PsExec.exe`, the default name for the
utility, followed by a network connection done by the process.

#### Possible investigation steps

- Check if the usage of this tool complies with the organization's administration policy.
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files
for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Identify the user account that performed the action and whether it should perform this kind of action.
- Identify the target computer and its role in the IT environment.
- Investigate what commands were run, and assess whether this behavior is prevalent in the environment by looking for
similar occurrences across hosts.

### False positive analysis

- This mechanism can be used legitimately. As long as the analyst did not identify suspicious activity related to the
user or involved hosts, and the tool is allowed by the organization's policy, such alerts can be dismissed.

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
  - Prioritize accordingly with the role of the servers and users involved.
- Isolate the involved hosts to prevent further post-compromise behavior.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are
identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business
systems, and web services.
- Run a full scan using the antimalware tool in place. This scan can reveal additional artifacts left in the system,
persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Review the privileges assigned to the user to ensure that the least privilege principle is being followed.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the
mean time to respond (MTTR).

Rule query

edit
sequence by process.entity_id [process where process.name :
"PsExec.exe" and event.type == "start" and /* This flag suppresses
the display of the license dialog and may indicate that psexec
executed for the first time in the machine */ process.args :
"-accepteula" and not process.executable : ("?:\\ProgramData\\Docu
snap\\Discovery\\discovery\\plugins\\17\\Bin\\psexec.exe",
"?:\\Docusnap 11\\Bin\\psexec.exe",
"?:\\Program Files\\Docusnap X\\Bin\\psexec.exe",
"?:\\Program Files\\Docusnap X\\Tools\\dsDNS.exe") and not
process.parent.executable : "?:\\Program Files (x86)\\Cynet\\Cynet
Scanner\\CynetScanner.exe"] [network where process.name :
"PsExec.exe"]

Threat mapping

edit

Framework: MITRE ATT&CKTM

Rule version history

edit
Version 102 (8.6.0 release)
  • Formatting only
Version 101 (8.5.0 release)
  • Formatting only
Version 9 (8.4.0 release)
  • Updated query, changed from:

    sequence by process.entity_id [process where process.name :
    "PsExec.exe" and event.type == "start"] [network where process.name
    : "PsExec.exe"]
Version 7 (7.12.0 release)
  • Formatting only
Version 6 (7.11.0 release)
  • Formatting only
Version 5 (7.10.0 release)
  • Updated query, changed from:

    event.category:network and event.type:connection and
    process.name:PsExec.exe
Version 4 (7.9.1 release)
  • Formatting only
Version 3 (7.9.0 release)
  • Updated query, changed from:

    process.name:PsExec.exe and event.action:"Network connection detected
    (rule: NetworkConnect)"
Version 2 (7.7.0 release)
  • Updated query, changed from:

    process.name:PsExec.exe and event.action:"Network connection detected
    (rule: NetworkConnect)"