T1021.004 IBM QRadar · QRadar

Detect SSH in IBM QRadar

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/

QRadar Detection Query

IBM QRadar (QRadar)
sql
SELECT
  DATEFORMAT(devicetime, 'yyyy-MM-dd HH:mm:ss') AS EventTime,
  sourceip AS SourceIP,
  destinationip AS DestinationIP,
  username AS Username,
  hostname AS Hostname,
  "COMMAND" AS CommandExecuted,
  CATEGORYNAME(category) AS EventCategory,
  QIDNAME(qid) AS EventName,
  logsourcename(logsourceid) AS LogSource
FROM events
WHERE
  LOGSOURCETYPEID IN (13, 9, 105, 347)
  AND (
    ("COMMAND" ILIKE '%ssh%' OR "COMMAND" ILIKE '%scp%' OR "COMMAND" ILIKE '%sftp%')
    AND (
      "COMMAND" ILIKE '%StrictHostKeyChecking=no%'
      OR "COMMAND" ILIKE '%ProxyJump%'
      OR "COMMAND" ILIKE '%ProxyCommand%'
      OR "COMMAND" ILIKE '% -D %'
      OR "COMMAND" ILIKE '% -L %'
      OR "COMMAND" ILIKE '% -R %'
      OR "COMMAND" ILIKE '% -N %'
      OR "COMMAND" ILIKE '% -i %'
      OR "COMMAND" ILIKE '%authorized_keys%'
    )
  )
  OR (
    QIDNAME(qid) ILIKE '%sshd%'
    AND (
      UTF8(payload) ILIKE '%Failed password%'
      OR UTF8(payload) ILIKE '%Invalid user%'
      OR UTF8(payload) ILIKE '%Accepted publickey%'
    )
  )
ORDER BY devicetime DESC
LAST 24 HOURS
high severity medium confidence

Detects suspicious SSH command execution patterns and SSH authentication anomalies via QRadar AQL by querying Linux audit logs and syslog sources for SSH tunnel flags, disabled host key checking, explicit identity file usage, and authorized_keys manipulation. Also surfaces brute-force patterns from sshd syslog.

Data Sources

Linux OS (syslog)Linux Audit Log (auditd)IBM QRadar Network Packet Capture

Required Tables

events

False Positives & Tuning

  • Infrastructure automation tools (Ansible, SaltStack) that routinely SSH to managed nodes using deployment keys and suppress host key prompts for dynamic inventory
  • IT operations teams using SSH ProxyJump configurations defined in corporate SSH config files for bastion host access patterns
  • CI/CD pipelines in containers that generate ephemeral authorized_keys entries during build or deploy stages
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