
Summary
Detects macOS SSH or autossh processes that establish a reverse (-R) or dynamic (-D) tunnel forwarding. The rule targets command lines where an SSH forwarding option is immediately followed by a forwarding specification (or equivalent arguments), indicating that local services are exposed to a remote/attacker-controlled endpoint or used as a SOCKS proxy. It intentionally excludes cases where the -R/-D is part of a remote command (e.g., rsync --server -D) to reduce false positives. Alerts are suppressed per host and user for 24 hours to surface the new tunnel owner for review. The detection emphasizes forwardings that reach common high-risk destinations (e.g., port 22, 5900, 3389) or use dynamic forwarding, which can enable attacker C2 or internal pivoting through outbound connections. The rule maps to MITRE ATT&CK techniques T1090 (Proxy) and T1572 (Protocol Tunneling) under the Command and Control tactic, reflecting its focus on tunnel-based covert access. It supports investigation steps around the forwarding target, unattended configurations (e.g., StrictHostKeyChecking=no, BatchMode=yes, ExitOnForwardFailure=yes, -N), suspicious key usage and locations, parent process lineage (LaunchAgents/LaunchDaemons, unsigned SSH binaries), and related persistence or credential exposure (e.g., changes to ~/.ssh/authorized_keys). Remediation guidance includes terminating the SSH process and restart loops, removing persistence and private keys, blocking the remote host, and rotating any exposed credentials. This rule leverages Elastic Defend data (Process events) on macOS endpoints and integrates into the endpoint detection workflow for proactive monitoring of covert SSH tunnels.
Categories
- macOS
- Endpoint
Data Sources
- Process
ATT&CK Techniques
- T1090
- T1572
Created: 2026-11-03