Join our Newsletter — 33% off our NHI Course
Home› Guides› T1651 Cloud Administration Command Defensive Guide: Controlling SSM…
Guide Attack Techniques & Malware

T1651 Cloud Administration Command Defensive Guide: Controlling SSM Run Command and Azure Run Command

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 27 October 2026 11 min read
On this page

Any cloud identity that can call AWS Systems Manager Run Command or Azure Run Command can execute code as root or SYSTEM on every virtual machine in scope, without a network path, a password or an endpoint exploit. MITRE ATT&CK T1651 Cloud Administration Command covers adversaries abusing cloud management services, such as AWS Systems Manager, Azure RunCommand and runbooks, to execute commands inside virtual machines through the installed VM agents. In ATT&CK v20 it sits in the Execution tactic (TA0002) on the IaaS platform. ATT&CK also notes that a compromised service provider or delegated administrator can do the same through a trusted relationship. This guide covers how defenders see the technique in control-plane and guest logs, which permissions to remove, and how to roll out restrictions without breaking operations. It is for cloud security engineers, detection engineers and platform owners. For Systems Manager configuration in depth see the AWS Systems Manager Security Guide.

Key takeaways

  • The permission is the privilege. ssm:SendCommand or Microsoft.Compute/virtualMachines/runCommand/action is effectively local administrator on every machine it can target.
  • Network controls do not help. Commands travel from the provider through the agent, so a VM with RDP and SSH closed is still reachable.
  • Both planes leave evidence. The control-plane call is logged by default; the guest shows the agent spawning a shell, so correlate the two.
  • Delegated access counts. APT29 used Azure Run Command together with Admin-on-Behalf-of, so partner and MSP permissions belong in scope.
  • Scope by document, tag and role. Restrict which commands, on which machines, by which identities, and keep execution rights out of day-to-day accounts.

How the attack works

ATT&CK describes the condition simply: an adversary with administrative access to a cloud environment can use cloud management services to run commands in its virtual machines. The services in scope, from a defender's point of view:

ServiceRequired permissionRuns asNotes for defenders
AWS Systems Manager Run Commandssm:SendCommand on the document and the target instance ARNsThe SSM Agent context, normally root on Linux and SYSTEM on WindowsDocuments such as AWS-RunShellScript and AWS-RunPowerShellScript accept arbitrary commands; output can go to S3 or CloudWatch Logs
AWS Systems Manager Session Managerssm:StartSessionA session user on the nodeInteractive shell without SSH; see the AWS Systems Manager Security Guide
Azure Action Run CommandMicrosoft.Compute/virtualMachines/runCommand/action (Virtual Machine Contributor and higher)System on Windows, root on LinuxBuilt-in commands include RunPowerShellScript, EnableRemotePS, EnableAdminAccount, SetRDPPort and DisableNLA
Azure Managed Run CommandMicrosoft.Compute/virtualMachines/runCommands/writeA customer-specified userDeployed as a resource, supports scale sets and parallel runs
Azure Automation runbooks and hybrid workersAutomation account contributor rightsThe runbook identity or worker accountScheduled or on-demand scripts with a managed identity attached
Google Cloud OS ConfigOS Config policy permissionsThe guest agentNamed by the ATT&CK analytic alongside the AWS and Azure services

Device management platforms are a close cousin. ATT&CK records VOID MANTICORE abusing built-in remote wipe and factory reset commands in an organisation's cloud management solution to wipe laptops, servers and mobile devices under this technique.

Where it shows up

  • Espionage through delegated access: ATT&CK records APT29 using Azure Run Command and Azure Admin-on-Behalf-of (AOBO) to execute code on virtual machines. See the APT29 (Midnight Blizzard) Threat Actor Profile and the GDAP and MSP Delegated Admin Access Guide.
  • Destructive operations: VOID MANTICORE's use of management-plane wipe commands shows the same pattern with an impact objective.
  • Post-compromise of cloud keys: once an attacker holds a role with Systems Manager or Contributor rights, Run Command is the quickest way from the control plane into workloads, often to read instance credentials or deploy tooling. See the ATT&CK Execution Tactic Guide.

Impact

Run Command gives the highest local privilege on the guest, at fleet scale, with a legitimate signed agent as the parent process. An adversary can read secrets and instance credentials, install persistence, disable security tools, enable remote access paths (Azure's own built-in commands include enabling remote PowerShell, the local Administrator account and disabling Network Level Authentication) or run destructive scripts across many machines at once. Because the activity uses an administration feature, it can be mistaken for routine operations unless the caller and timing are checked.

Detection

The ATT&CK v20 detection strategy for T1651 looks for commands run by unexpected users, outside maintenance windows or by service accounts not normally tied to administration, and correlates control-plane activity with process creation inside the guest.

PlaneSource and eventAlert when
AWS control planeCloudTrail SendCommand, StartSession, CreateAssociation; ECS ExecuteCommandCaller has not used the API in the last 30 days; document is a generic shell document; many targets at once; source outside your automation accounts
Azure control planeActivity log Microsoft.Compute/virtualMachines/runCommand/action and runCommands/writeCaller is a user or service principal outside the operations group, a guest or a partner tenant; run outside change windows
Azure AutomationActivity log job and runbook create and update operationsNew runbooks or schedules, or runbooks edited by unusual principals
Windows guestProcess creation (Security 4688, Sysmon 1) with parent ssm-agent-worker.exe, ssm-document-worker.exe or the Azure guest agent; RunCommandExtension.log under C:\WindowsAzure\Logs\PluginsPowerShell or cmd launched by the agent with network or credential access activity following
Linux guestauditd execve, Sysmon for Linux; /var/log/azure/run-command/handler.logShells spawned by the agent that download files, touch credential stores or create users
Command outputRun Command output in S3 or CloudWatch LogsOutput logging disabled on a command, or output buckets changed
  • Baseline the callers: in most estates only a pipeline role, a patching service and a small operations group send commands. Anything else is high signal. See the Service Account Behavioural Baselining Guide.
  • Join the planes: a control-plane call with no corresponding change ticket, followed within minutes by an agent-spawned shell, is the strongest correlation.
  • Watch the role assignments too: a new Virtual Machine Contributor or Systems Manager policy attachment often precedes the first command.

Metrics

  • Execution rights spread: number of principals able to send commands, per account or subscription, trending down.
  • Unscoped grants: share of ssm:SendCommand grants with no document or tag restriction.
  • Change linkage: share of Run Command executions that map to a change record or pipeline run.
  • Output logging coverage: share of executions with full output stored centrally.
  • Delegated admin exposure: count of partner relationships with VM contributor or equivalent rights.

Prevention and hardening

  • Limit who can execute (M1026): ATT&CK advises limiting the number of cloud accounts able to run commands on VMs and not using them for day-to-day operations. Move Run Command rights into just-in-time privileged roles. See the Cloud PAM and CIEM Guide.
  • Restrict documents in AWS: grant ssm:SendCommand only on the ARNs of approved custom documents, not document/* or generic shell documents. AWS notes that if you use global condition keys such as aws:SourceVpce with SendCommand, you must also allow aws:ViaAWSService.
  • Restrict targets by tag: use the ssm:resourceTag/<key> condition on instance ARNs so a team can only reach its own machines; untagged targets return AccessDenied. Protect the tags themselves, or the restriction can be undone by retagging.
  • Use narrow Azure roles: Virtual Machine Contributor and higher include Run Command. Build custom roles for VM operators without runCommand/action and runCommands/write, and grant them to an operations group through Privileged Identity Management. See the Azure RBAC and Service Principals Guide.
  • Do not rely on removing the extension: Microsoft documents that the Run Command extension is reinstalled automatically the next time a command is applied, so RBAC is the real control.
  • Guardrails at organisation level: service control policies can deny ssm:SendCommand except from named automation roles; Azure Policy and management group role assignments do the equivalent. See the AWS Organizations and SCPs Guide.
  • Review delegated access: remove partner and MSP roles that include VM execution unless contractually needed, and prefer time-bound access. See the Azure Lighthouse Security Guide.
  • Require approval for destructive fleet actions: for device management, use multi-admin approval for wipe and similar commands where the platform offers it. See the Microsoft Intune Guide.

Choosing controls

SituationFirst stepsTrade-off
Run Command used daily by operationsApproved custom documents only, tag-scoped targets, output to central logsEngineers lose ad hoc shell documents; provide reviewed alternatives
Rarely used, break-glass onlySCP or policy deny for all but one just-in-time roleSlower emergency response; rehearse the elevation path
Heavy MSP or partner managementSeparate delegated roles without execution rights, time-bound elevationPartner workflows need redesign
Small team, few VMsRemove Contributor from humans, alert on every executionAlert volume is low enough to review every event

Phased rollout

  1. Inventory: list every principal with SendCommand, StartSession, runCommand or runbook rights, including partner tenants and pipeline roles.
  2. Observe: enable the detection rules above and record 30 days of legitimate executions by caller, document and target.
  3. Scope: rewrite grants to approved documents and tags, and custom Azure roles without execution, testing in one account or subscription first.
  4. Enforce: apply organisation-level denies for everything outside the approved callers. Rollback is removing the deny from one unit while grants are corrected.
  5. Exercise: run an authorised benign command from an unapproved test identity and confirm it is denied or alerted, and that the guest-side correlation fires.

Where identity fits

T1651 is an identity problem first. The callers are IAM roles, access keys, service principals and managed identities, many of them non-human and broadly scoped for convenience. A leaked CI role with Systems Manager rights, or an automation account managed identity with Contributor on a subscription, is a remote shell on every machine. Treat these identities as privileged, give each an owner, and remove execution rights they do not use. See the AWS IAM Policies and Roles Guide and the OWASP NHI Top 10 NHI5 Overprivileged NHI Guide.

Lessons from incidents

  • Management-plane commands can be the whole attack: in the Stryker cyberattack, attackers with a hijacked administrator account issued the Intune remote wipe command; no wiper malware was needed on endpoints. Multi-admin approval and scoped roles are the lessons that carry over to VM run commands.
  • Trusted partners extend the blast radius: APT29's use of AOBO with Run Command shows that delegated administration must be reviewed as carefully as your own roles.

Framework mapping

FrameworkReferences
ATT&CKM1026 Privileged Account Management; related T1199 Trusted Relationship, T1078.004 Cloud Accounts
NIST SP 800-53 Rev. 5AC-6 Least Privilege, AC-2 Account Management, CM-7 Least Functionality, AU-6 Audit Record Review, Analysis, and Reporting, SI-4 System Monitoring
NIST CSF 2.0PR.AA-05 (least privilege and separation of duties), DE.CM-03 (technology usage monitored), PR.PS-04 (log records generated)
CIS Controls v8.1Control 5 Account Management, Control 6 Access Control Management, Control 8 Audit Log Management
MITRE D3FENDD3-JFAPA Job Function Access Pattern Analysis, D3-RAPA Resource Access Pattern Analysis

Practitioner checklist

  • List every identity able to run commands on VMs, including partners, pipelines and managed identities.
  • Restrict ssm:SendCommand to approved documents and tag-scoped targets.
  • Replace Virtual Machine Contributor for operators with custom roles that exclude Run Command.
  • Make execution rights just-in-time and remove them from day-to-day accounts.
  • Alert on SendCommand, StartSession and Azure runCommand calls from unexpected principals or outside change windows.
  • Collect guest process telemetry and correlate agent-spawned shells with control-plane calls.
  • Send Run Command output to central storage and alert when it is disabled.
  • Require multi-admin approval for destructive fleet commands where available.

Standards and references

Related NHI Mgmt Group resources: AWS Systems Manager Security Guide · AWS IAM Policies and Roles Guide · ATT&CK Execution Tactic Guide · Azure RBAC and Service Principals Guide · Cloud Incident Response Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 27 October 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.