T1021.004 - Remote Services: SSH
Description from ATT&CK (opens in a new tab)
Adversaries may use Valid Accounts (opens in a new tab) 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.(Citation: Sygnia ESXi Ransomware 2025)(Citation: TrendMicro ESXI Ransomware)(Citation: Sygnia Abyss Locker 2025) 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 (opens in a new tab)).
Atomic Tests
Atomic Test #1 - ESXi - Enable SSH via PowerCLI
An adversary enables the SSH service on a ESXi host to maintain persistent access to the host and to carryout subsequent operations.
Supported Platforms: Windows
auto_generated_guid: 8f6c14d1-f13d-4616-b7fc-98cc69fe56ec
Inputs:
Name | Description | Type | Default Value |
---|---|---|---|
vm_host | Specify the host name of the ESXi Server | string | atomic.local |
vm_user | Specify the privilege user account on ESXi Server | string | root |
vm_pass | Specify the privilege user password on ESXi Server | string | pass |
Attack Commands: Run with powershell
! Elevation Required (e.g. root or admin)
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -ParticipateInCEIP:$false -Confirm:$false
Connect-VIServer -Server #{vm_host} -User #{vm_user} -Password #{vm_pass}
Get-VMHostService -VMHost #{vm_host} | Where-Object {$_.Key -eq "TSM-SSH" } | Start-VMHostService -Confirm:$false
Cleanup Commands:
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -ParticipateInCEIP:$false -Confirm:$false
Connect-VIServer -Server #{vm_host} -User #{vm_user} -Password #{vm_pass}
Get-VMHostService -VMHost #{vm_host} | Where-Object {$_.Key -eq "TSM-SSH" } | Stop-VMHostService -Confirm:$false
Dependencies: Run with powershell
!
Description: Check if VMWARE PowerCLI PowerShell Module is installed.
Check Prereq Commands:
$RequiredModule = Get-Module -Name VMware.PowerCLI -ListAvailable
if (-not $RequiredModule) {exit 1}
Get Prereq Commands:
Install-Module -Name VMware.PowerCLI
Atomic Test #2 - ESXi - Enable SSH via VIM-CMD
An adversary enables SSH on an ESXi host to maintain persistence and creeate another command execution interface. Reference (opens in a new tab)
Supported Platforms: Windows
auto_generated_guid: 280812c8-4dae-43e9-a74e-1d08ab997c0e
Inputs:
Name | Description | Type | Default Value |
---|---|---|---|
vm_host | Specify the host name or IP of the ESXi server. | string | atomic.local |
vm_user | Specify the privilege user account on the ESXi server. | string | root |
vm_pass | Specify the privileged user's password. | string | password |
plink_file | Path to Plink | path | PathToAtomicsFolder\..\ExternalPayloads\plink.exe |
Attack Commands: Run with command_prompt
!
echo "" | "#{plink_file}" -batch "#{vm_host}" -ssh -l #{vm_user} -pw "#{vm_pass}" "vim-cmd hostsvc/enable_ssh"
Cleanup Commands:
echo "" | "#{plink_file}" -batch "#{vm_host}" -ssh -l #{vm_user} -pw "#{vm_pass}" "vim-cmd hostsvc/disable_ssh"
Dependencies: Run with powershell
!
Description: Check if we have plink
Check Prereq Commands:
if (Test-Path "#{plink_file}") {exit 0} else {exit 1}
Get Prereq Commands:
New-Item -Type Directory "PathToAtomicsFolder\..\ExternalPayloads\" -ErrorAction Ignore -Force | Out-Null
Invoke-WebRequest "https://the.earth.li/~sgtatham/putty/latest/w64/plink.exe" -OutFile "#{plink_file}"