T1021.004 Google Chronicle · YARA-L

Detect SSH in Google Chronicle

Adversaries may use Valid Accounts to log into remote machines using Secure Shell (SSH). SSH allows authorized users to open remote shells on Linux, macOS, and ESXi systems. Adversaries leverage existing SSH keys or stolen passwords to pivot between systems. Notable actors using SSH for lateral movement include FIN7, Lazarus Group, Leviathan, Scattered Spider, BlackTech, and APT groups targeting cloud and ESXi environments. SSH lateral movement may also involve agent forwarding abuse, key theft, adding attacker-controlled public keys to authorized_keys files, or chaining through multiple hosts to obscure the original source.

MITRE ATT&CK

Tactic
Lateral Movement
Technique
T1021 Remote Services
Sub-technique
T1021.004 SSH
Canonical reference
https://attack.mitre.org/techniques/T1021/004/

YARA-L Detection Query

Google Chronicle (YARA-L)
yaral
rule ssh_lateral_movement_suspicious {
  meta:
    author = "Argus Detection Engineering"
    description = "Detects suspicious SSH lateral movement including tunneling, disabled host key checking, explicit identity key usage, ProxyJump chaining, and authorized_keys modification on Linux and macOS endpoints."
    mitre_attack_tactic = "Lateral Movement"
    mitre_attack_technique = "T1021.004"
    severity = "HIGH"
    confidence = "HIGH"

  events:
    (
      $e.metadata.event_type = "PROCESS_LAUNCH"
      and (
        $e.principal.process.file.full_path = /\/(ssh|scp|sftp|ssh-agent|ssh-add)$/
        or $e.target.process.file.full_path = /\/(ssh|scp|sftp|ssh-agent|ssh-add)$/
      )
      and (
        $e.target.process.command_line = /StrictHostKeyChecking.?no/
        or $e.target.process.command_line = / -i /
        or $e.target.process.command_line = /ProxyJump/
        or $e.target.process.command_line = /ProxyCommand/
        or $e.target.process.command_line = / -[DLRN] /
        or $e.target.process.command_line = /authorized_keys/
      )
    )
    or
    (
      $e.metadata.event_type = "FILE_MODIFICATION"
      and $e.target.file.full_path = /\.ssh\/authorized_keys/
    )

  match:
    $e.principal.hostname over 5m

  condition:
    $e
}
high severity high confidence

Chronicle YARA-L 2.0 rule detecting suspicious SSH lateral movement via UDM process launch events and file modification events. Matches SSH tunnel creation flags (-D, -L, -R, -N), disabled strict host key checking, ProxyJump/ProxyCommand chaining, explicit identity key usage, and unauthorized modifications to authorized_keys files.

Data Sources

Chronicle UDM (Unified Data Model)Google Chronicle Endpoint TelemetryLinux OS parser (auditd/syslog ingested via Chronicle forwarder)

Required Tables

UDM events (PROCESS_LAUNCH, FILE_MODIFICATION)

False Positives & Tuning

  • System administration scripts using SSH with custom keys and permissive host checking for automated patching or configuration management across large server fleets
  • Container orchestration platforms (Kubernetes operators, Helm hooks) that establish SSH tunnels or manage authorized_keys for node bootstrapping
  • Penetration testing teams conducting authorized internal red team exercises that simulate SSH lateral movement as part of scoped engagements
Download portable Sigma rule (.yml)

Other platforms for T1021.004


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1SSH Lateral Movement to Remote Host

    Expected signal: Linux auditd EXECVE record for ssh binary with arguments. Syslog entry from sshd on target: 'Accepted password for testuser from <source_ip>'. Linux auditd USER_LOGIN event. Process creation for ssh child process.

  2. Test 2SSH SOCKS Proxy Tunnel Creation

    Expected signal: Linux auditd EXECVE for ssh with -D 1080 -N -f flags. Process runs in background (due to -f flag). Network connection established on source port 1080 (SOCKS listener). Syslog entry on target for SSH connection.

  3. Test 3Add Attacker SSH Public Key to authorized_keys

    Expected signal: Linux auditd OPEN event for ~/.ssh/authorized_keys with write flag. File modification timestamp change. Sysmon for Linux (if deployed): FileCreate/FileModify event for authorized_keys path.

  4. Test 4SSH Key-Based Lateral Movement with Stolen Key

    Expected signal: Linux auditd EXECVE for ssh with -i /tmp/stolen_id_rsa. OPEN event for /tmp/stolen_id_rsa (private key access). Network connection to target port 22. Syslog on target: 'Accepted publickey for root'.

Unlock Pro Content

Get the full detection package for T1021.004 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections