Detection rules › Elastic

AWS SSM Session Manager Child Process Execution

Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies process start events where the parent process is the AWS Systems Manager (SSM) Session Manager worker. Session Manager provides interactive shell access to EC2 instances and hybrid nodes without bastion hosts or open inbound ports. Adversaries abuse it for remote execution and lateral movement using legitimate AWS credentials and IAM permissions. This rule surfaces endpoint execution occurring under that worker for visibility and hunting. Expect noise from authorized administrative sessions.

Known false positives

  • Legitimate operators using AWS Systems Manager Session Manager to administer instances will spawn child processes under the session worker. Tune with host, user, or command-line exclusions for known automation and break-glass workflows.
  • The SSM agent may invoke short-lived utilities (for example identity or environment probes) during session setup. Additional exclusions may be required in your environment.

MITRE ATT&CK coverage

Telemetry coverage

Rule body

[metadata]
creation_date = "2026/04/03"
integration = ["endpoint", "auditd_manager", "crowdstrike", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/06/01"

[rule]
author = ["Elastic"]
description = """
Identifies process start events where the parent process is the AWS Systems Manager (SSM) Session Manager worker. 
Session Manager provides interactive shell access to EC2 instances and hybrid nodes without bastion hosts or open inbound ports.
Adversaries abuse it for remote execution and lateral movement using legitimate AWS credentials and IAM permissions.
This rule surfaces endpoint execution occurring under that worker for visibility and hunting. Expect noise from authorized
administrative sessions.
"""
false_positives = [
    """
    Legitimate operators using AWS Systems Manager Session Manager to administer instances will spawn child processes
    under the session worker. Tune with host, user, or command-line exclusions for known automation and break-glass
    workflows.
    """,
    """
    The SSM agent may invoke short-lived utilities (for example identity or environment probes) during session setup.
    Additional exclusions may be required in your environment.
    """,
]
from = "now-9m"
index = [
    "logs-endpoint.events.process*",
    "auditbeat-*",
    "logs-auditd_manager.auditd-*",
    "logs-crowdstrike.fdr*",
    "logs-sentinel_one_cloud_funnel.*"
]
language = "kuery"
license = "Elastic License v2"
name = "AWS SSM Session Manager Child Process Execution"
note = """## Triage and analysis

### Investigating AWS SSM Session Manager Child Process Execution

AWS Systems Manager Session Manager starts a session worker process on the endpoint; commands and shells you run in the
session appear as child processes of that worker. The same mechanism is used for authorized administration and for
adversary activity when IAM credentials or instance roles allow `ssm:StartSession` (or related) abuse.

### Possible investigation steps

- Confirm whether the host is an EC2 instance or managed node that legitimately uses Session Manager.
- Review `process.command_line`, `process.executable`, `process.user.name`, and `user.name` for the child process to
  judge intent (reconnaissance, download, credential access, persistence, etc.).
- Correlate timing with AWS CloudTrail for `StartSession`, `ResumeSession`, or related SSM API calls and the IAM
  principal that initiated the session.
- Pivot on the same `host.id` or instance identifier for other alerts or SSM activity in the same window.

### False positive analysis

- Routine interactive or automated administration via Session Manager is expected to match this rule by design.
- Prefer exclusions tied to stable attributes (approved IAM roles, automation service accounts, known script paths)
  rather than broad process-name allowlists unless validated.

### Response and remediation

- If activity is unauthorized: revoke or rotate exposed IAM credentials, review SSM and VPC endpoints policies, and
  terminate suspicious sessions from the AWS console or API.
- Isolate the instance if compromise is suspected and perform endpoint forensics following your incident response
  playbook.
"""
references = [
    "https://www.mitiga.io/blog/abusing-the-amazon-web-services-ssm-agent-as-a-remote-access-trojan",
    "https://hackingthe.cloud/aws/post_exploitation/run_shell_commands_on_ec2/",
    "https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager.html",
]
risk_score = 47
rule_id = "cf2b8cf5-3364-4396-b551-42aae9b6d37e"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "Domain: Cloud",
    "OS: Linux",
    "OS: Windows",
    "OS: macOS",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Data Source: Elastic Defend",
    "Data Source: Auditd Manager",
    "Data Source: Crowdstrike",
    "Data Source: SentinelOne",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
event.category: "process" and event.action : ("exec" or "exec_event" or "start" or "ProcessRollup2" or "executed" or "process_started") and
(
 process.parent.name:("ssm-session-worker.exe" or "ssm-session-worker" or "ssm-document-worker.exe" or "ssm-document-worker") or 
 (process.name : "powershell.exe" and process.args : *awsrunPowerShellScript*) or
 (process.name : ("dash" or "sh" or "bash") and process.args : *awsrunShellScript*) or 
 (process.parent.name : "powershell.exe" and process.parent.args : *awsrunPowerShellScript*) or
 (process.parent.name : ("dash" or "sh" or "bash") and process.parent.args : *awsrunShellScript*)
 ) and 
 not (process.name : "powershell.exe" and process.args :("$str.Substring($str.length" or *Convert-GuidToCompressedGuid* or get-wmiobject* or $wmi_proc* or *win32_quickfixengineering* or Get-wmiobject* or *Get-Service* or *Get-WmiObject* or *System32\\ntoskrnl.exe* or *GET-WMIOBJECT*)) and 
 not process.executable : ("/usr/bin/lscpu" or "/usr/bin/snap" or "/usr/bin/rpm" or "/usr/bin/dpkg-query" or /snap/snapd/*/usr/bin/snap or "/usr/bin/id" or "C:\\Program Files\\Amazon\\SSM\\Plugins\\SessionManagerShell\\winpty-agent.exe" or /var/lib/amazon/ssm/update/amazon-ssm-agent-updater/*/updater or C\:\\ProgramData\\Amazon\\SSM\\Update\\amazon-ssm-agent-updater\\*\\updater.exe) and 
 not (process.name : (dash or bash or sh or _script.sh) and process.args : /var/lib/amazon/ssm/*/document/orchestration/*/_script.sh) and 
 process.command_line :(* and not (*ssm-user or */invokeInspectorSsmPluginLinux/_script.sh or */checkExclusionPreference/_script.sh or *\\createUpdateFolder\\_script.ps1 or */checkProvisioningEligibility/_script.sh or */install/_script.sh or */uninstall/_script.sh))
'''

[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"

[[rule.threat.technique.subtechnique]]
name = "Unix Shell"
id = "T1059.004"
reference = "https://attack.mitre.org/techniques/T1059/004/"

[[rule.threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
    
[[rule.threat.technique]]
id = "T1651"
name = "Cloud Administration Command"
reference = "https://attack.mitre.org/techniques/T1651/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

Stages and Predicates

Stage 1: query

event.category: "process" and event.action : ("exec" or "exec_event" or "start" or "ProcessRollup2" or "executed" or "process_started") and
(
 process.parent.name:("ssm-session-worker.exe" or "ssm-session-worker" or "ssm-document-worker.exe" or "ssm-document-worker") or
 (process.name : "powershell.exe" and process.args : *awsrunPowerShellScript*) or
 (process.name : ("dash" or "sh" or "bash") and process.args : *awsrunShellScript*) or
 (process.parent.name : "powershell.exe" and process.parent.args : *awsrunPowerShellScript*) or
 (process.parent.name : ("dash" or "sh" or "bash") and process.parent.args : *awsrunShellScript*)
 ) and
 not (process.name : "powershell.exe" and process.args :("$str.Substring($str.length" or *Convert-GuidToCompressedGuid* or get-wmiobject* or $wmi_proc* or *win32_quickfixengineering* or Get-wmiobject* or *Get-Service* or *Get-WmiObject* or *System32\\ntoskrnl.exe* or *GET-WMIOBJECT*)) and
 not process.executable : ("/usr/bin/lscpu" or "/usr/bin/snap" or "/usr/bin/rpm" or "/usr/bin/dpkg-query" or /snap/snapdupdater or C\:\\ProgramData\\Amazon\\SSM\\Update\\amazon-ssm-agent-updater\\*\\updater.exe) and
 not (process.name : (dash or bash or sh or _script.sh) and process.args : /var/lib/amazon/ssm_script.sh) and
 process.command_line :(* and not (*ssm-user or */invokeInspectorSsmPluginLinux/_script.sh or */checkExclusionPreference/_script.sh or *\\createUpdateFolder\\_script.ps1 or */checkProvisioningEligibility/_script.sh or */install/_script.sh or */uninstall/_script.sh))

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseq$str.Substring($str.lengthexcludes:process.args field:"process.args" value:"$str.Substring($str.length"
process.argsmatchConvert-GuidToCompressedGuidexcludes:process.args field:"process.args" value:"Convert-GuidToCompressedGuid"
process.argsmatchGET-WMIOBJECTexcludes:process.args field:"process.args" value:"GET-WMIOBJECT"
process.argsmatchGet-Serviceexcludes:process.args field:"process.args" value:"Get-Service"
process.argsmatchGet-WmiObjectexcludes:process.args field:"process.args" value:"Get-WmiObject"
process.argsmatchSystem32\ntoskrnl.exeexcludes:process.args field:"process.args" value:"System32\ntoskrnl.exe"
process.argsmatchwin32_quickfixengineeringexcludes:process.args field:"process.args" value:"win32_quickfixengineering"
process.argsstarts_with$wmi_procexcludes:process.args field:"process.args" value:"$wmi_proc"
process.argsstarts_withGet-wmiobjectexcludes:process.args field:"process.args" value:"Get-wmiobject"
process.argsstarts_withget-wmiobjectexcludes:process.args field:"process.args" value:"get-wmiobject"
process.nameeqpowershell.exeexcludes:process.name field:"process.name" value:"powershell.exe"
process.argswildcard/var/lib/amazon/ssm/*/document/orchestration/*/_script.shexcludes:process.args field:"process.args" value:"/var/lib/amazon/ssm/*/document/orchestration/*/_script.sh"
process.namein_script.sh, bash, dash, shexcludes:process.name
process.command_lineends_with/checkExclusionPreference/_script.shexcludes:process.command_line field:"process.command_line" value:"/checkExclusionPreference/_script.sh"
process.command_lineends_with/checkProvisioningEligibility/_script.shexcludes:process.command_line field:"process.command_line" value:"/checkProvisioningEligibility/_script.sh"
process.command_lineends_with/install/_script.shexcludes:process.command_line field:"process.command_line" value:"/install/_script.sh"
process.command_lineends_with/invokeInspectorSsmPluginLinux/_script.shexcludes:process.command_line field:"process.command_line" value:"/invokeInspectorSsmPluginLinux/_script.sh"
process.command_lineends_with/uninstall/_script.shexcludes:process.command_line field:"process.command_line" value:"/uninstall/_script.sh"
process.command_lineends_with\createUpdateFolder\_script.ps1excludes:process.command_line field:"process.command_line" value:"\createUpdateFolder\_script.ps1"
process.command_lineends_withssm-userexcludes:process.command_line field:"process.command_line" value:"ssm-user"
process.executableeq/usr/bin/dpkg-queryexcludes:process.executable field:"process.executable" value:"/usr/bin/dpkg-query"
process.executableeq/usr/bin/idexcludes:process.executable field:"process.executable" value:"/usr/bin/id"
process.executableeq/usr/bin/lscpuexcludes:process.executable field:"process.executable" value:"/usr/bin/lscpu"
process.executableeq/usr/bin/rpmexcludes:process.executable field:"process.executable" value:"/usr/bin/rpm"
process.executableeq/usr/bin/snapexcludes:process.executable field:"process.executable" value:"/usr/bin/snap"
process.executableeqC:\Program Files\Amazon\SSM\Plugins\SessionManagerShell\winpty-agent.exeexcludes:process.executable field:"process.executable" value:"C:\Program Files\Amazon\SSM\Plugins\SessionManagerShell\winpty-agent.exe"
process.executablewildcard/snap/snapd/*/usr/bin/snapexcludes:process.executable field:"process.executable" value:"/snap/snapd/*/usr/bin/snap"
process.executablewildcard/var/lib/amazon/ssm/update/amazon-ssm-agent-updater/*/updaterexcludes:process.executable field:"process.executable" value:"/var/lib/amazon/ssm/update/amazon-ssm-agent-updater/*/updater"
process.executablewildcardC:\ProgramData\Amazon\SSM\Update\amazon-ssm-agent-updater\*\updater.exeexcludes:process.executable field:"process.executable" value:"C:\ProgramData\Amazon\SSM\Update\amazon-ssm-agent-updater\*\updater.exe"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • ProcessRollup2
  • exec
  • exec_event
  • executed
  • process_started
  • start
field:"EventType" kind:in
event.categoryeq
  • process
field:"event.category" kind:eq value:"process"
process.argswildcard
  • *awsrunPowerShellScript*
  • *awsrunShellScript*
field:"process.args" kind:wildcard
process.command_lineis_not_null
  • (no value, null check)
field:"CommandLine" kind:is_not_null
process.nameeq
  • powershell.exe
field:"process_name" kind:eq value:"powershell.exe"
process.namein
  • bash
  • dash
  • sh
field:"process_name" kind:in
process.parent.argswildcard
  • *awsrunPowerShellScript*
  • *awsrunShellScript*
field:"process.parent.args" kind:wildcard
process.parent.nameeq
  • powershell.exe
field:"parent_process_name" kind:eq value:"powershell.exe"
process.parent.namein
  • bash
  • dash
  • sh
  • ssm-document-worker
  • ssm-document-worker.exe
  • ssm-session-worker
  • ssm-session-worker.exe
field:"parent_process_name" kind:in