# AWS SSM Agent Abused as a Living-off-the-Land Remote Access Trojan via Hybrid-Activation Hijacking and Parallel Agent Processes

> Mitiga researchers demonstrate how an attacker who already holds root/administrator access on an EC2 instance or on-prem/hybrid host can repurpose the legitimate, pre-installed, Amazon-signed AWS Systems Manager (SSM) Agent as a stealthy Remote Access Trojan — either by re-registering it to an attacker-controlled AWS account via hybrid activation, or by running a second, hidden SSM agent process alongside the legitimate one — giving persistent, trusted-binary C2 without deploying any separate malware.

- **Published:** 2026-07-26T00:00:00Z
- **Last reviewed:** 2026-07-26T00:00:00Z
- **Canonical:** https://intel.threadlinqs.com/threat/TL-2026-1709
- **Card image:** https://intel.threadlinqs.com/og/threat/threat-intel-aws-ssm-agent-hybrid-hijack-tl-2026-1709.webp?v=768bbf88 (Threadlinqs threat intel: AWS SSM Agent Hybrid-Activation Hijack: Detection & IOCs (TL-2026-1709) — Medium severity, 21 IOCs, 9 detection rules.)
- **ID:** TL-2026-1709
- **Severity:** MEDIUM
- **Category:** CLOUD
- **Status:** ACTIVE
- **Detections:** 9 (1 shown free below) · **IOCs:** 21

## Description

AWS Systems Manager (SSM) Agent is a signed, first-party Amazon binary pre-installed on most Amazon Linux, Ubuntu, Windows Server, and (on EC2) macOS images, and is commonly installed on-prem and in other clouds via 'hybrid activation' for centralized fleet management. Because it is trusted, digitally signed, and frequently excluded from EDR/AV inspection, Mitiga researchers (building on 2019 and January 2021 prior work by cloudonaut.io and Nick Frichette) show it can be weaponized as a Remote Access Trojan by an attacker who already has initial code execution and root/administrator privileges.

Two exploitation scenarios are documented. Scenario 1 (Agent Hijacking) re-registers the already-installed SSM Agent to an attacker-owned AWS account using AWS Systems Manager's legitimate hybrid-activation workflow: the attacker generates an activation code/ID pair in their own account (CreateActivation), stops the local agent, runs it with '-register -code <ACTIVATION_CODE> -id <ACTIVATION_ID> -region <REGION>', and restarts it — after which the agent reports to and executes RunCommand/StartSession commands from the attacker's account instead of (or in addition to) the victim's, over normal-looking HTTPS/WSS traffic to ec2messages/ssmmessages endpoints. Scenario 2 (Parallel/Hidden Agent) runs a second SSM agent process alongside the legitimate one so the original registration and connectivity are left undisturbed: on Linux this is done either via a Linux namespace (copy agent files to an alternate path, 'unshare' into a new mount namespace, mount the alternate copy over the original path) requiring elevated-but-not-necessarily-root privileges, or via the agent's container-mode configuration flag (adjusts credential-source order to bypass the ECS metadata service, works without sudo, but is restricted to the 'Start Session' capability only); on Windows, environment variables are set to redirect the agent's configuration lookup to an attacker-controlled alternate storage location, preserving 'Run Command' access.

Both scenarios avoid dropping any new malware: all execution occurs through the trusted, Amazon-signed amazon-ssm-agent binary, so file-hash/signature-based and application-allowlisting controls do not flag it, and traffic blends into expected AWS Systems Manager network flows. The technique requires no CVE — AWS confirmed it as intended (if under-hardened) product behavior rather than a vulnerability requiring a patch, after Mitiga privately disclosed it. A public proof-of-concept toolkit (github.com/mitiga/ssm-as-rat) demonstrates both scenarios. The Mitiga writeup was substantively updated on 2026-07-22, four days before this hunt, indicating continued relevance and likely refreshed guidance (organization-wide SSM command-output logging to S3/CloudWatch, scrutiny of CreateActivation events, and VPC Endpoint restriction) that keeps the technique live for defenders in 2026.

## MITRE ATT&CK

- T1543 Create or Modify System Process
- T1078 Valid Accounts
- T1036 Masquerading
- T1218 System Binary Proxy Execution
- T1078 Valid Accounts
- T1219 Remote Access Tools
- T1102 Web Service
- T1071 Application Layer Protocol
- T1090 Proxy
- T1570 Lateral Tool Transfer
- T1021 Remote Services
- T1059 Command and Scripting Interpreter
- T1583 Acquire Infrastructure

## Free detection (Splunk SPL, Microsoft KQL, Sigma)

**AWS SSM Agent Hybrid-Activation Hijack Registration (Splunk)** (`TL-2026-1709-SPL-001`)

Detects amazon-ssm-agent / amazon-ssm-agent.exe invoked with the hybrid-activation registration flag set (-register -code -id -region), the exact command-line pattern used to re-point a legitimate, Amazon-signed SSM Agent to an attacker-controlled AWS account (Mitiga 'ssm-as-rat' Scenario 1: Agent Hijacking). Correlates the Windows and Linux process-creation shapes of the same technique.

- **Languages:** Splunk SPL, Microsoft KQL, Sigma
- **ATT&CK:** T1078.004, T1036.005, T1218, T1543.002, T1543.003
- **Data sources:** sysmon, windows_security, linux_auditd, syslog
- **Severity:** high
- **Confidence:** high

### Splunk SPL

```spl
(
  index=sysmon sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
  (Image="*\\amazon-ssm-agent.exe" OR OriginalFileName="amazon-ssm-agent.exe")
  CommandLine="*-register*" CommandLine="*-code*" CommandLine="*-id*" CommandLine="*-region*"
  | eval platform="windows", proc=Image, cmdline=CommandLine, host=ComputerName, acct=User
)
| append [
  search index=linux_auditd OR index=nix sourcetype IN ("linux_secure","syslog","auditd")
  (proctitle="*amazon-ssm-agent*" OR comm="amazon-ssm-agent")
  proctitle="*-register*" proctitle="*-code*" proctitle="*-id*" proctitle="*-region*"
  | eval platform="linux", proc=comm, cmdline=proctitle, host=host, acct=uid
]
| eval mitre_techniques="T1078.004,T1036.005,T1218,T1543.002,T1543.003"
| table _time, platform, host, acct, proc, cmdline, mitre_techniques
| sort -_time
```

### Microsoft KQL

```kql
union
(
    DeviceProcessEvents
    | where Timestamp > ago(24h)
    | where FileName in~ ("amazon-ssm-agent.exe","amazon-ssm-agent")
    | where ProcessCommandLine has_all ("-register","-code","-id","-region")
    | extend Platform = iif(FileName endswith ".exe", "windows", "linux")
    | project Timestamp, Platform, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessFileName, ReportId
),
(
    SecurityEvent
    | where TimeGenerated > ago(24h)
    | where EventID == 4688
    | where NewProcessName has "amazon-ssm-agent.exe"
    | where CommandLine has_all ("-register","-code","-id","-region")
    | extend Platform = "windows"
    | project Timestamp = TimeGenerated, Platform, DeviceName = Computer, AccountName = Account, FileName = NewProcessName, ProcessCommandLine = CommandLine, InitiatingProcessFileName = ParentProcessName, ReportId = EventID
)
| order by Timestamp desc
```

### Sigma

```yaml
title: AWS SSM Agent Hybrid-Activation Hijack Registration
id: 7c1a1e2a-2f3d-4b7e-9a1e-1c9b2a6f0a01
status: experimental
description: Detects amazon-ssm-agent (Windows or Linux) invoked with hybrid-activation registration flags (-register -code -id -region), indicating possible re-registration to an attacker-controlled AWS account (Mitiga SSM-as-RAT Scenario 1).
references:
    - https://www.mitiga.io/blog/abusing-the-amazon-web-services-ssm-agent-as-a-remote-access-trojan
    - https://github.com/mitiga/ssm-as-rat
    - https://detection.fyi/sigmahq/sigma/linux/process_creation/proc_creation_lnx_ssm_agent_abuse/
    - https://detection.fyi/sigmahq/sigma/windows/process_creation/proc_creation_win_ssm_agent_abuse/
author: Threadlinqs Team
date: 2026-07-26
tags:
    - attack.persistence
    - attack.defense-evasion
    - attack.t1078.004
    - attack.t1036.005
    - attack.t1218
    - attack.t1543.002
    - attack.t1543.003
    - attack.tool.ssm-as-rat
logsource:
    category: process_creation
detection:
    selection_windows:
        Image|endswith: '\amazon-ssm-agent.exe'
        CommandLine|contains|all:
            - '-register'
            - '-code'
            - '-id'
            - '-region'
    selection_linux:
        Image|endswith: '/amazon-ssm-agent'
        CommandLine|contains|all:
            - '-register'
            - '-code'
            - '-id'
            - '-region'
    condition: 1 of selection_*
falsepositives:
    - Legitimate, deliberate hybrid-activation re-registration performed by an authorized administrator during planned fleet onboarding, DR failover, or account migration
level: high
```

**Known false positives:**

- Legitimate, deliberate hybrid-activation re-registration performed by an authorized administrator during planned fleet onboarding, DR failover, or account migration

**Tuning notes:** Maintain a change-management allowlist of approved hybrid-activation maintenance windows/service accounts and suppress matches inside them; alert unconditionally on any occurrence outside a known change window, since legitimate use of '-register' is otherwise narrow.

### 8 more detection rules (Splunk SPL, Microsoft KQL, Sigma), unlock with TL Creds

- AWS SSM Agent Hybrid-Activation Hijack Registration (Sentinel) (locked: unlock with TL Creds)
- AWS SSM Agent Parallel/Hidden-Agent Persistence (Sentinel) (locked: unlock with TL Creds)
- AWS SSM CreateActivation / StartSession / SendCommand from Unexpected Principal (Sentinel) (locked: unlock with TL Creds)
- AWS SSM Agent Hybrid-Activation Hijack Registration (Sigma) (locked: unlock with TL Creds)
- AWS SSM Agent Parallel/Hidden-Agent Persistence (Sigma) (locked: unlock with TL Creds)
- AWS SSM CreateActivation / StartSession / SendCommand from Unexpected Principal (Sigma) (locked: unlock with TL Creds)
- AWS SSM Agent Parallel/Hidden-Agent Persistence (Splunk) (locked: unlock with TL Creds)
- AWS SSM CreateActivation / StartSession / SendCommand from Unexpected Principal (Splunk) (locked: unlock with TL Creds)

Sign up free to unlock the detection rules: https://threadlinqs.com/?modal=signup

## Sources

- [More on Abusing the Amazon Web Services SSM Agent as a Remote Access Trojan](https://www.mitiga.io/blog/abusing-the-amazon-web-services-ssm-agent-as-a-remote-access-trojan)
- [AWS SSM Agent source code](https://github.com/aws/amazon-ssm-agent)
- [ssm-as-rat proof-of-concept scripts](https://github.com/mitiga/ssm-as-rat)
- [Security Advisory: Abusing the SSM Agent as a Remote Access Trojan](https://cloudsecurityalliance.org/blog/2023/10/13/security-advisory-abusing-the-ssm-agent-as-a-remote-access-trojan)
- [More on Abusing the Amazon Web Services SSM Agent as a Remote Access Trojan (CSA republish)](https://cloudsecurityalliance.org/blog/2023/11/14/more-on-abusing-the-amazon-web-services-ssm-agent-as-a-remote-access-trojan)
- [SSM Agent Tomfoolery](https://frichetten.com/blog/ssm-agent-tomfoolery/)
- [AWS SSM is a Trojan Horse, Fix it Now!](https://cloudonaut.io/aws-ssm-is-a-trojan-horse-fix-it-now/)
- [Potential Linux Amazon SSM Agent Hijacking (Sigma rule)](https://detection.fyi/sigmahq/sigma/linux/process_creation/proc_creation_lnx_ssm_agent_abuse/)
- [Potential Amazon SSM Agent Hijacking (Sigma rule, Windows)](https://detection.fyi/sigmahq/sigma/windows/process_creation/proc_creation_win_ssm_agent_abuse/)
- [Amazon's AWS SSM agent can be used as post-exploitation RAT malware](https://www.bleepingcomputer.com/news/security/amazons-aws-ssm-agent-can-be-used-as-post-exploitation-rat-malware/)
- [Researchers warn Amazon's AWS System Manager agent can be used as a RAT](https://www.csoonline.com/article/648672/researchers-warn-amazons-aws-system-manager-agent-can-be-used-as-a-rat.html)
- [Attackers can turn AWS SSM agents into remote access trojans](https://www.helpnetsecurity.com/2023/08/02/aws-instances-attackers-access/)
- [Researchers Uncover AWS SSM Agent Misuse as a Covert Remote Access Trojan](https://thehackernews.com/2023/08/researchers-uncover-aws-ssm-agent.html)
- [Deciphering the Risks of AWS SSM in Hybrid Environments](https://pentera.io/blog/deciphering-risk-of-aws-sssm-in-hybrid-environments/)

## Full data

The other 8 detection rules (Splunk SPL / Microsoft KQL / Sigma) unlock with TL Creds; a free account includes daily creds: https://threadlinqs.com/?modal=signup
Indicator values unlock with TL Creds, at a lower price on Red and Purple; AI agents can query rules and IOCs through the Threadlinqs MCP server (Purple): https://intel.threadlinqs.com/mcp

Canonical: https://intel.threadlinqs.com/threat/TL-2026-1709
