Cross-source coverage

T1563.001 / ATT&CK

Remote Service Session Hijacking: SSH Hijacking

10 rules across 2 sources.

From MITRE ATT&CK 19.2

Adversaries may hijack a legitimate user's SSH session to move laterally within an environment. Secure Shell (SSH) is a standard means of remote access on Linux and macOS systems. It allows a user to connect to another system via an encrypted tunnel, commonly authenticating through a password, certificate or the use of an asymmetric encryption key pair.

In order to move laterally from a compromised host, adversaries may take advantage of trust relationships established with other systems via public key authentication in active SSH sessions by hijacking an existing connection to another system. This may occur through compromising the SSH agent itself or by having access to the agent's socket. If an adversary is able to obtain root access, then hijacking SSH sessions is likely trivial.

SSH Hijacking differs from use of SSH because it hijacks an existing SSH session rather than creating a new session using Valid Accounts.

Platforms
Linux · macOS
Telemetry
auditd:SYSCALLauditd:EXECVENSM:Connectionsmacos:unifiedlog

How MITRE says to detect it DET0256

Detection Strategy for SSH Session Hijacking

Linux Analytic 0710

Suspicious reuse of SSH agent sockets across multiple users or processes, anomalous access to ~/.ssh/ or /tmp/ssh-* sockets, and abnormal patterns of lateral movement via SSH without new authentication events. Defender view: detect when one process accesses another user's SSH agent or when an existing SSH connection is used to pivot unexpectedly.

  • auditd:SYSCALL open or connect syscalls on /tmp/ssh-* or $SSH_AUTH_SOCK
  • auditd:EXECVE Execution of ssh/scp/sftp without corresponding authentication log
  • NSM:Connections Missing new login event but session activity continues

macOS Analytic 0711

Unusual access to SSH agent sockets in /tmp/ or /private/tmp, process access to another user’s $SSH_AUTH_SOCK, and lateral SSH activity without corresponding login events. Defender view: correlation of socket access with anomalous network flows to internal systems.

  • macos:unifiedlog Process opening SSH_AUTH_SOCK or /tmp/ssh-* socket not owned by same UID
  • macos:unifiedlog Execution of ssh or sftp without corresponding login event
  • macos:unifiedlog Session reuse without new auth event

elastic/detection-rules

8 rules
Detection Severity Format
Potential THC Tool Downloaded High Elastic TOML
Network Connection Initiated by Suspicious SSHD Child Process Medium Elastic TOML
Potential Execution via SSH Backdoor Medium Elastic TOML
SSH Authorized Key File Activity Detected via Defend for Containers Medium Elastic TOML
SSH Authorized Keys File Activity Medium Elastic TOML
Renaming of OpenSSH Binaries Low Elastic TOML
SSH Key Generated via ssh-keygen Low Elastic TOML
Unusual SSHD Child Process Low Elastic TOML

elastic/protections-artifacts

2 rules
Detection Severity Format
Potential HackersChoice Tool Downloaded Undefined Elastic TOML
Unusual SSH Parent/Child Execution Undefined Elastic TOML

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.