T1021.004 SSH
Sub-technique of: T1021
High-Level Description
Adversaries may use Valid Accounts to log into remote machines using Secure Shell (SSH). The adversary may then perform actions as the logged-on user.
SSH is a protocol that allows authorized users to open remote shells on other computers. Many Linux and macOS versions come with SSH installed by default, although typically disabled until the user enables it. On ESXi, SSH can be enabled either directly on the host (e.g., via vim-cmd hostsvc/enable_ssh) or via vCenter. The SSH server can be configured to use standard password authentication or public-private keypairs in lieu of or in addition to a password. In this authentication scenario, the user’s public key must be in a special file on the computer running the server that lists which keypairs are allowed to login as that user (i.e., SSH Authorized Keys).
Kill Chain Phase
- Lateral Movement (TA0008)
Platforms: ESXi, Linux, macOS
What to Check
- Identify if SSH technique is applicable to target environment
- Check ESXi systems for indicators of SSH
- Check Linux systems for indicators of SSH
- Check macOS systems for indicators of SSH
- Verify mitigations are bypassed or absent (3 known mitigations)
- Assess detection coverage (1 detection strategies)
How to Test
Manual Testing
Identify Attack Surface: Determine if the target environment is susceptible to SSH by examining the target platforms (ESXi, Linux, macOS).
Assess Existing Defenses: Review whether mitigations for T1021.004 are in place. If defenses are absent or misconfigured, this technique may be exploitable.
Execute Test: Use tools and methods described in the MITRE ATT&CK page and external references below.
Note: No Atomic Red Team tests available for this technique. See Atomic Red Team GitHub for updates.
Remediation Guide
M1042 Disable or Remove Feature or Program
Disable the SSH daemon on systems that do not require it, especially ESXi servers. For macOS, ensure Remote Login is disabled under Sharing Preferences.
M1032 Multi-factor Authentication
Require multi-factor authentication for SSH connections wherever possible, such as password protected SSH keys.
M1018 User Account Management
Limit which user accounts are allowed to login via SSH.
Detection
Behavioral Detection of Remote SSH Logins Followed by Post-Login Execution
Risk Assessment
| Finding | Severity | Impact |
|---|---|---|
| SSH technique applicable | Low | Lateral Movement |
CWE Categories
| CWE ID | Title |
|---|---|
| CWE-284 | Improper Access Control |