SMB Connections via LOLBin or Untrusted Process

Last updated 2 days ago on 2025-02-03
Created 5 years ago on 2020-02-18

About

Identifies potentially suspicious processes that are not trusted or living-off-the-land binaries (LOLBin) making Server Message Block (SMB) network connections over port 445. Windows File Sharing is typically implemented over SMB, which communicates between hosts using port 445. Legitimate connections are generally established by the kernel (PID 4). This rule helps to detect processes that might be port scanners, exploits, or user-level processes attempting lateral movement within the network by leveraging SMB connections.
Tags
Domain: EndpointOS: WindowsUse Case: Threat DetectionTactic: Lateral MovementData Source: Elastic DefendLanguage: eql
Severity
medium
Risk Score
47
MITRE ATT&CK™

Lateral Movement (TA0008)(opens in a new tab or window)

License
Elastic License v2(opens in a new tab or window)

Definition

Rule Type
Event Correlation Rule
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
logs-endpoint.events.process-*logs-endpoint.events.network-*
Related Integrations

endpoint(opens in a new tab or window)

Query
sequence by process.entity_id with maxspan=1m

  /* first sequence to capture the start of Windows processes */
  [process where host.os.type == "windows" and event.type == "start" and process.pid != 4 and

    /* ignore NT Authority and Network Service accounts */
    not user.id : ("S-1-5-19", "S-1-5-20") and

    /* filter out anything trusted but not from Microsoft */
    /* LOLBins will be inherently trusted and signed, so ignore everything else trusted */
    not (process.code_signature.trusted == true and not startsWith(process.code_signature.subject_name, "Microsoft")) and

    /* filter out PowerShell scripts from Windows Defender ATP */
    not (
      process.name : "powershell.exe" and
      process.args :"?:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Downloads\\PSScript_*.ps1")]

  /* second sequence to capture network connections over port 445 related to SMB */
  [network where host.os.type == "windows" and destination.port == 445 and process.pid != 4]

/* end the sequence when the process ends where joining was on process.entity_id */
until [process where host.os.type == "windows" and event.type == "end"]

Install detection rules in Elastic Security

Detect SMB Connections via LOLBin or Untrusted Process in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).