Detection rules › Elastic

Binary Proxy Execution via Windows OpenSSH

Source
github.com/elastic/protections-artifacts

Identifies attempts to execute programs via the Windows OpenSSH client. This may indicate an attempt to bypass application control via trusted windows binaries.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies attempts to execute programs via the Windows OpenSSH client. This may indicate an attempt to bypass
application control via trusted windows binaries.
"""
id = "a9b41132-04c7-421e-9aaf-b2c8718a66d0"
license = "Elastic License v2"
name = "Binary Proxy Execution via Windows OpenSSH"
os_list = ["windows"]
reference = ["https://lolbas-project.github.io/lolbas/Binaries/Ssh/"]
version = "1.0.7"

query = '''
process where event.action == "start" and
(
 (process.parent.executable : ("?:\\windows\\system32\\OpenSSH\\ssh.exe", "C:\\Windows\\System32\\OpenSSH\\sftp.exe") and
 process.parent.args == "-o" and process.parent.command_line : ("*ProxyCommand=*", "*LocalCommand=*") and
 not process.executable : ("?:\\Windows\\system32\\conhost.exe", "?:\\Program Files\\Amazon\\AWSCLIV2\\aws.exe", "C:\\Windows\\System32\\OpenSSH\\ssh.exe")) or

 (process.executable : ("?:\\windows\\system32\\OpenSSH\\ssh.exe", "C:\\Windows\\System32\\OpenSSH\\sftp.exe") and
  process.parent.name : ("explorer.exe", "python.exe", "conhost.exe") and
  process.command_line : ("*Command=*powershell*", "*schtasks*create*", "*LocalCommand=@echo off &&*",
                          "*Command=cmd /c*", "*ProxyCommand=*cmd.exe *", "*Command=\"cmd /c*", "*LocalCommand=scp*&&*", "*LocalCommand=?scp*&&*") )
)
'''

min_endpoint_version = "7.16.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"


[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "7.16.0"

Stages and Predicates

Stage 1: process

process where event.action == "start" and
(
 (process.parent.executable : ("?:\\windows\\system32\\OpenSSH\\ssh.exe", "C:\\Windows\\System32\\OpenSSH\\sftp.exe") and
 process.parent.args == "-o" and process.parent.command_line : ("*ProxyCommand=*", "*LocalCommand=*") and
 not process.executable : ("?:\\Windows\\system32\\conhost.exe", "?:\\Program Files\\Amazon\\AWSCLIV2\\aws.exe", "C:\\Windows\\System32\\OpenSSH\\ssh.exe")) or

 (process.executable : ("?:\\windows\\system32\\OpenSSH\\ssh.exe", "C:\\Windows\\System32\\OpenSSH\\sftp.exe") and
  process.parent.name : ("explorer.exe", "python.exe", "conhost.exe") and
  process.command_line : ("*Command=*powershell*", "*schtasks*create*", "*LocalCommand=@echo off &&*",
                          "*Command=cmd /c*", "*ProxyCommand=*cmd.exe *", "*Command=\"cmd /c*", "*LocalCommand=scp*&&*", "*LocalCommand=?scp*&&*") )
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
process.command_linewildcard
  • *Command="cmd /c*
  • *Command=*powershell* corpus 2 (elastic 2)
  • *Command=cmd /c*
  • *LocalCommand=?scp*&&* corpus 2 (elastic 2)
  • *LocalCommand=@echo off &&*
  • *LocalCommand=scp*&&* corpus 2 (elastic 2)
  • *ProxyCommand=*cmd.exe *
  • *schtasks*create*
field:"CommandLine" kind:wildcard
process.executablewildcard
  • ?:\windows\system32\OpenSSH\ssh.exe corpus 3 (elastic 3)
  • C:\Windows\System32\OpenSSH\sftp.exe
field:"Image" kind:wildcard
process.parent.argseq
  • -o
field:"process.parent.args" kind:eq value:"-o"
process.parent.command_linewildcard
  • *LocalCommand=*
  • *ProxyCommand=* corpus 2 (elastic 1, splunk 1)
field:"ParentCommandLine" kind:wildcard
process.parent.executablewildcard
  • ?:\windows\system32\OpenSSH\ssh.exe
  • C:\Windows\System32\OpenSSH\sftp.exe
field:"ParentImage" kind:wildcard
process.parent.namewildcard
  • conhost.exe corpus 8 (elastic 8)
  • explorer.exe corpus 51 (elastic 50, splunk 1)
  • python.exe corpus 4 (elastic 4)
field:"parent_process_name" kind:wildcard