Revert Cloud Instance
An adversary may revert changes made to a cloud instance after performing malicious activities to evade detection and remove evidence of their presence. In highly virtualized cloud environments, this may be accomplished by restoring virtual machine or data storage snapshots through the cloud management dashboard or cloud APIs. Adversaries may also leverage temporary ephemeral storage attached to compute instances, which resets upon instance stop/restart, to avoid leaving persistent forensic artifacts on disk. This technique is commonly used as a final step in a cloud intrusion: exfiltrate data, perform lateral movement, then restore the instance to a pre-attack snapshot to destroy forensic evidence of the compromise.
// Detect cloud instance snapshot revert operations (T1578.004)
// Covers Azure disk/VM restore operations and AWS snapshot-based recovery
let TimeWindow = 24h;
// Azure: Detect VM disk restore from snapshot, restore point operations, and VM recapture
let AzureRevertOps = AzureActivity
| where TimeGenerated > ago(TimeWindow)
| where OperationNameValue has_any (
"Microsoft.Compute/disks/write",
"Microsoft.Compute/restorePoints/write",
"Microsoft.Compute/restorePointCollections/write",
"Microsoft.Compute/virtualMachines/capture/action",
"Microsoft.Compute/virtualMachines/write",
"Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems/recovery/action"
)
| where ActivityStatusValue =~ "Success"
| where Properties_d has_any ("snapshot", "restorePoint", "diskRestorePoint", "creationData", "Copy", "Restore")
| extend CloudProvider = "Azure"
| extend ActorIdentity = Caller
| extend SourceIP = CallerIpAddress
| extend Operation = OperationNameValue
| extend TargetResource = _ResourceId
| project TimeGenerated, CloudProvider, ActorIdentity, SourceIP, Operation, TargetResource, ResourceGroup, SubscriptionId;
// AWS: Detect EC2/EBS snapshot restore and instance revert operations via CloudTrail
let AWSRevertOps = AWSCloudTrail
| where TimeGenerated > ago(TimeWindow)
| where EventName in (
"ImportSnapshot",
"RestoreSnapshotTier",
"CreateRestoreImageTask",
"CopySnapshot",
"RegisterImage",
"RunInstances",
"AttachVolume",
"DetachVolume",
"ModifyVolume",
"StopInstances",
"StartInstances"
)
| where isempty(ErrorCode)
| extend CloudProvider = "AWS"
| extend ActorIdentity = UserIdentityArn
| extend SourceIP = SourceIpAddress
| extend Operation = EventName
| extend TargetResource = tostring(RequestParameters)
| project TimeGenerated, CloudProvider, ActorIdentity, SourceIP, Operation, TargetResource, AWSRegion, RecipientAccountId;
// Union results and annotate operation type
AzureRevertOps
| union AWSRevertOps
| extend IsEphemeralReset = (Operation in ("StopInstances", "StartInstances"))
| extend IsSnapshotRestore = (Operation has_any ("snapshot", "Snapshot", "restorePoint", "RestoreImage", "RegisterImage", "ImportSnapshot", "CopySnapshot", "RestoreSnapshotTier", "CreateRestoreImageTask", "recovery"))
| sort by TimeGenerated desc Data Sources
Required Tables
False Positives
- Legitimate disaster recovery operations by cloud operations teams restoring instances from approved snapshots per a runbook or change ticket
- Automated backup and restore testing performed by cloud platform engineering or DevOps teams as part of DR drills
- Development and staging environment resets where instances are routinely reverted to known-good snapshots via CI/CD pipelines
- Patch rollback procedures reverting instances after a failed software update or breaking configuration change
- Chaos engineering or resilience testing platforms (e.g., AWS Fault Injection Simulator, Azure Chaos Studio) that deliberately stop and restart instances
References (15)
- https://attack.mitre.org/techniques/T1578/004/
- https://www.techrepublic.com/blog/the-enterprise-cloud/backing-up-and-restoring-snapshots-on-amazon-ec2-machines/
- https://cloud.google.com/compute/docs/disks/restore-and-delete-snapshots
- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSSnapshots.html
- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-store-volumes.html
- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html
- https://learn.microsoft.com/en-us/azure/virtual-machines/snapshot-copy-managed-disk
- https://learn.microsoft.com/en-us/azure/backup/backup-azure-arm-restore-vms
- https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference.html
- https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1578.004/T1578.004.md
- https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/
- https://unit42.paloaltonetworks.com/cloud-lateral-movement-techniques/
- https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RegisterImage.html
- https://learn.microsoft.com/en-us/rest/api/compute/disks/create-or-update
Unlock Pro Content
Get the full detection package for T1578.004 including response playbook, investigation guide, and atomic red team tests.