LoFP LoFP / legitimate use of ssh proxycommand or localcommand with scripting engines may trigger this detection. filter as needed based on your environment's normal ssh usage patterns and authorized scripting activities.

Techniques

Sample rules

Windows SSH Proxy Command

Description

This detection identifies potential abuse of SSH “ProxyCommand” or “LocalCommand” by monitoring for suspicious process execution patterns. Specifically, it looks for instances where ssh.exe (as a parent process) containing “ProxyCommand” or “LocalCommand” in its arguments spawns potentially malicious child processes like mshta, powershell, wscript, or cscript, or processes containing “http” in their command line. This technique can be used by attackers to execute arbitrary commands through SSH proxy configurations, potentially enabling command & control activities or remote code execution. The detection focuses on commonly abused Windows scripting engines and web requests that may indicate malicious activity when spawned through SSH proxy commands.

Detection logic


| tstats `security_content_summariesonly`
  count min(_time) as firstTime
        max(_time) as lastTime

from datamodel=Endpoint.Processes where

Processes.parent_process_name="ssh.exe"
(
  Processes.parent_process = "*ProxyCommand=*"
  OR
  (
    Processes.parent_process = "* PermitLocalCommand=yes*"
    Processes.parent_process = "* LocalCommand=*"
  )
)

Processes.process IN (
  "*cscript*",
  "*http*",
  "*mshta*",
  "*powershell*",
  "*pwsh*",
  "*wmic*",
  "*wscript*"
)

by Processes.action Processes.dest Processes.original_file_name Processes.parent_process Processes.parent_process_exec
   Processes.parent_process_guid Processes.parent_process_id Processes.parent_process_name Processes.parent_process_path
   Processes.process Processes.process_exec Processes.process_guid Processes.process_hash Processes.process_id
   Processes.process_integrity_level Processes.process_name Processes.process_path Processes.user Processes.user_id
   Processes.vendor_product


| `drop_dm_object_name(Processes)`

| `security_content_ctime(firstTime)`

| `security_content_ctime(lastTime)`

| `windows_ssh_proxy_command_filter`