Query Details
# Rule Documentation: SSH Reverse Tunnel Established to External Host ## Description Detects SSH reverse tunneling or remote port forwarding to external hosts, which attackers use to create persistent command-and-control channels or pivot through an internal host to external infrastructure. - **Source:** The DFIR Report — From Bing Search to Ransomware: Bumblebee and AdaptixC2 Deliver Akira (Aug 05, 2025) ## Detection Logic - Monitor outbound `ssh` process creation with remote forwarding flags (`-R`, `-L`) or unusual port numbers. - Alert on internal hosts initiating SSH connections to external IPs with remote port binds (e.g., `ssh -R *:10400`). - Correlate with newly installed remote access tools or suspicious user accounts. ## Tags - Command and Control - Lateral Movement - MITRE ATT&CK: T1572 (Protocol Tunneling), T1040 (Network Sniffing) ## Search Query ```kql DeviceProcessEvents | where FileName =~ "ssh.exe" or ProcessCommandLine contains "ssh " | where ProcessCommandLine contains "-R" or ProcessCommandLine contains "-L" or ProcessCommandLine contains "RemoteForward" | project Timestamp, DeviceName, InitiatingProcessAccountName, ProcessCommandLine, ReportId ``` ## Note This rule is very noisy and will generate a lot of alerts it needs to be adjusted to remove any legitimate behavior
This query is designed to detect potentially malicious SSH reverse tunneling activities, which can be used by attackers to maintain control over a compromised system or to move laterally within a network. Here's a simple breakdown of the query and its purpose:
Objective: The query aims to identify SSH processes that might be used for reverse tunneling or remote port forwarding to external hosts. This is a technique often used by attackers to establish persistent command-and-control channels or to pivot from an internal network to external infrastructure.
Detection Criteria:
ssh.exe) on devices.-R) or local forwarding (-L), or the term "RemoteForward" in the command line. These flags are indicative of port forwarding activities.Context:
Considerations:
In summary, this query helps security teams identify suspicious SSH activities that could indicate an attacker's attempt to establish unauthorized network connections or control channels. However, due to its broad detection criteria, it may need refinement to reduce false alarms.

Ali Hussein
Released: November 10, 2025
Tables
Keywords
Operators