# Abuse of AWS Systems Manager (SSM) Agent as a Remote Access Trojan

> Mitiga researchers documented a post-exploitation technique that repurposes the legitimate, Amazon-signed AWS Systems Manager (SSM) Agent on Linux and Windows EC2 hosts into a Remote Access Trojan. Attackers with root/administrator access hijack the agent into hybrid mode under an attacker-controlled AWS account, run a second parallel agent process, or proxy SSM traffic through an attacker-controlled endpoint, then use built-in RunCommand/StartSession features for command-and-control while evading EDR tools that trust the signed binary.

- **Published:** 2026-07-22T00:00:00Z
- **Last reviewed:** 2026-07-22T00:00:00Z
- **Canonical:** https://intel.threadlinqs.com/threat/TL-2026-1644
- **Card image:** https://intel.threadlinqs.com/og/threat/threat-intel-aws-ssm-agent-rat-tl-2026-1644.webp?v=de72c52c (Threadlinqs threat intel: AWS Systems Manager (SSM) Agent RAT: Detection & IOCs (TL-2026-1644) — Medium severity, 16 IOCs, 9 detection rules.)
- **ID:** TL-2026-1644
- **Severity:** MEDIUM
- **Category:** TTP
- **Status:** ACTIVE
- **Detections:** 9 (1 shown free below) · **IOCs:** 16

## Description

In a July 31, 2023 security advisory, Mitiga researchers detailed a living-off-the-land post-exploitation technique abusing the AWS Systems Manager (SSM) Agent, a signed, first-party binary pre-installed on most default Amazon Machine Images (AMIs) and widely deployed across AWS EC2 fleets for patch management, command execution, and session access. Because the SSM Agent binary is Amazon-signed and near-universally allowlisted by antivirus and EDR products (Mitiga noted 0 of 71 VirusTotal engines flagged it as malicious), an attacker who has already obtained root (Linux) or Administrator (Windows) level access on an EC2 instance can repurpose the existing, trusted agent into a full remote-access channel instead of dropping custom malware.

Three distinct exploitation scenarios were documented:

1. **Hijacking the original agent (hybrid-mode re-registration).** The attacker stops the running amazon-ssm-agent service, re-registers it in SSM 'hybrid activation' mode using an activation code/ID generated in an AWS account they control (`amazon-ssm-agent -register -code <ACTIVATION_CODE> -id <ACTIVATION_ID> -region <REGION>`), and restarts the service. The instance now takes RunCommand and Session Manager (StartSession) instructions from the attacker's AWS account instead of, or in addition to, the legitimate owning account, bypassing the EC2 instance metadata service (IMDS) for identity. This method is persistent across reboots.

2. **Running a second, parallel SSM Agent process.** Rather than hijacking the original agent (which could disrupt legitimate management and tip off defenders), the attacker launches an independent second amazon-ssm-agent process registered to their own AWS account, isolated from the original using Linux namespaces (on Linux) or a modified environment/registry context (on Windows), while the legitimate agent continues operating normally and undisturbed. This requires only a non-root/non-admin foothold to execute in some configurations described by the researchers, though full agent control still assumes elevated access to install/run the second binary persistently.

3. **Mock/proxy SSM server.** The attacker modifies the `http_proxy`/`https_proxy` environment variables (or equivalent proxy configuration) consumed by the SSM Agent so its command-and-control traffic is routed through an attacker-controlled proxy server rather than direct to AWS Systems Manager endpoints, which can also route traffic outside AWS entirely and reduce AWS-side visibility into the C2 channel.

In all scenarios the attacker gains a fully functional, Amazon-signed RAT capable of arbitrary command execution (RunCommand), interactive shell access (Session Manager StartSession), and file transfer, providing persistence, defense evasion, and command-and-control without deploying any additional flagged malware. Potential downstream impact includes data theft, ransomware deployment, cryptomining, and lateral movement across the compromised environment. AWS's public response characterized the behavior as expected/by-design ('software and systems are behaving as designed and there is no need for customers to take any action'), placing the burden of detection and prevention on defenders via SIEM/EDR tuning and network-layer restriction (VPC endpoint policies) rather than a product fix, and Mitiga's detection guidance and AWS's mitigation guidance were published together with the advisory. No CVE was assigned, consistent with this being a technique abusing intended agent functionality rather than a software vulnerability.

## MITRE ATT&CK

- T1133 External Remote Services
- T1219 Remote Access Tools
- T1219.002 Remote Desktop Software
- T1036 Masquerading
- T1127 Trusted Developer Utilities Proxy Execution
- T1685 Disable or Modify Tools
- T1098 Account Manipulation
- T1098.001 Additional Cloud Credentials
- T1059 Command and Scripting Interpreter
- T1569.002 Service Execution
- T1526 Cloud Service Discovery
- T1078.004 Cloud Accounts
- T1090.002 External Proxy
- T1489 Service Stop
- T1486 Data Encrypted for Impact

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

**SSM Agent Hybrid-Mode Hijack Registration (CLI Flags) — SPL** (`TL-2026-1644-SPL-001`)

Detects execution of amazon-ssm-agent / amazon-ssm-agent.exe with the -register -code -id -region hybrid-activation flag combination on an already-provisioned EC2 instance, the signature of an attacker re-registering the trusted SSM agent to their own AWS account.

- **Languages:** Splunk SPL, Microsoft KQL, Sigma
- **ATT&CK:** T1219.002, T1098.001, T1036
- **Data sources:** sysmon, linux_auditd, windows_security
- **Severity:** high
- **Confidence:** high

### Splunk SPL

```spl
index=endpoint (sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" OR sourcetype="linux_secure" OR sourcetype="syslog") EventCode=1
(Image="*amazon-ssm-agent*" OR process_name="*amazon-ssm-agent*")
CommandLine="*-register*" CommandLine="*-code*" CommandLine="*-id*" CommandLine="*-region*"
| eval instance_data_mismatch=if(match(CommandLine, "i-0[A-Za-z0-9]+"), "check_instance_id", "n/a")
| stats count min(_time) as first_seen max(_time) as last_seen values(CommandLine) as cmdlines by host, user
| where count > 0
| table host, user, first_seen, last_seen, count, cmdlines
```

### Microsoft KQL

```kql
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName has_any ("amazon-ssm-agent", "amazon-ssm-agent.exe")
| where ProcessCommandLine has "-register" and ProcessCommandLine has "-code" and ProcessCommandLine has "-id" and ProcessCommandLine has "-region"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessAccountName
| order by Timestamp desc
```

### Sigma

```yaml
title: Potential AWS SSM Agent Hijack Hybrid-Mode Re-Registration
id: 7c2f9a1e-4b3d-4e2a-9f10-1a2b3c4d5e01
status: experimental
description: Detects amazon-ssm-agent invoked with the hybrid-activation -register/-code/-id/-region flag combination, indicating an attacker re-registering the agent to an attacker-controlled AWS account
references:
    - https://www.mitiga.io/blog/mitiga-security-advisory-abusing-the-ssm-agent-as-a-remote-access-trojan
author: Threadlinqs Team
date: 2026-07-22
tags:
    - attack.persistence
    - attack.t1098.001
    - attack.t1219.002
    - attack.defense_evasion
    - attack.t1036
logsource:
    category: process_creation
    product: windows
detection:
    selection:
        Image|endswith:
            - '\amazon-ssm-agent.exe'
            - '/amazon-ssm-agent'
        CommandLine|contains|all:
            - '-register'
            - '-code'
            - '-id'
            - '-region'
    condition: selection
falsepositives:
    - Legitimate initial provisioning/activation of a new hybrid-activation managed instance by an authorized administrator
level: high
```

**Known false positives:**

- Legitimate first-time hybrid-activation registration of a new managed instance by an authorized administrator during onboarding

**Tuning notes:** Suppress for hosts/instance-IDs on a documented hybrid-activation onboarding allowlist; alert only when the activation account/ID does not match the organization's expected activation registry.

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

- SSM Agent Service Stop Immediately Preceding Hijack Re-Registration — KQL (locked: unlock with TL Creds)
- [indicator]/[indicator] Environment Variable Change in SSM Agent Process Context — KQL (locked: unlock with TL Creds)
- SendCommand AWS-RunShellScript/RunPowerShellScript Burst from New or Rare Principal — KQL (locked: unlock with TL Creds)
- Unexpected Instance-Data Directory Under SSM InstanceData Path (Instance-ID Mismatch) — Sigma (locked: unlock with TL Creds)
- [indicator] Binary Removed from AV/EDR Allowlist Trust Anomaly — Sigma (locked: unlock with TL Creds)
- IAM Principal Newly Granted ssm:SendCommand/StartSession/CreateActivation Permissions — Sigma (locked: unlock with TL Creds)
- Multiple Concurrent [indicator] Processes — SPL (locked: unlock with TL Creds)
- CloudTrail SSM StartSession/SendCommand/CreateActivation from Unexpected Principal — SPL (locked: unlock with TL Creds)

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

## Sources

- [Mitiga Security Advisory: Abusing the SSM Agent as a Remote Access Trojan](https://www.mitiga.io/blog/mitiga-security-advisory-abusing-the-ssm-agent-as-a-remote-access-trojan)
- [Researchers Uncover AWS SSM Agent Misuse as a Covert Remote Access Trojan](https://thehackernews.com/2023/08/researchers-uncover-aws-ssm-agent.html)
- [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/)
- [Mitiga report reveals unique way to abuse AWS Systems Manager agent](https://siliconangle.com/2023/08/02/mitiga-research-reveals-unique-way-abuse-aws-systems-manager-agent/)
- [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)
- [Threat Actors Use AWS SSM Agent as a Remote Access Trojan](https://www.infosecurity-magazine.com/news/threat-actors-use-aws-ssm-agent-rat/)
- [Attackers can turn AWS SSM agents into remote access trojans](https://www.helpnetsecurity.com/2023/08/02/aws-instances-attackers-access/)
- [Sigma Rule: Potential Amazon SSM Agent Hijacking](https://valhalla.nextron-systems.com/info/sigma-rule/d20ee2f4-822c-4827-9e15-41500b1fff10)

## 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-1644
