PIVTR-D
RAWS playbook · Compute and containers

Resource hijacking and cryptomining

The attacker launches large or GPU instances, often in Regions you never use, and asks for higher quotas to run more of them. Spot requests, fleets and Auto Scaling groups relaunch instances you terminate. Contain the launching identity first, then remove the relaunch mechanism before you clean up.

Look here

LogSearch for
CloudTrail, EC2 eventsLaunches, key pairs and opened ports in every Region: RunInstances, RequestSpotInstances, CreateFleet, ImportKeyPair, CreateKeyPair, AuthorizeSecurityGroupIngress
CloudTrail, every RegionRunInstances calls in each enabled Region, saved to one file per Region: for r in $(aws ec2 describe-regions --query "Regions[].RegionName" --output text); do aws cloudtrail lookup-events --region $r --lookup-attributes AttributeKey=EventName,AttributeValue=RunInstances --start-time <utc> > <case>-runinstances-$r.json; done
CloudTrail, Auto ScalingGroups and templates that relaunch instances. A group with a desired capacity above zero replaces any instance you terminate: CreateAutoScalingGroup, UpdateAutoScalingGroup, CreateLaunchTemplate, CreateLaunchTemplateVersion
Running instances, every RegionRunning instances with type, launch time and instance profile: for r in $(aws ec2 describe-regions --query "Regions[].RegionName" --output text); do aws ec2 describe-instances --region $r --filters Name=instance-state-name,Values=running --query "Reservations[].Instances[].[InstanceId,InstanceType,LaunchTime,IamInstanceProfile.Arn]" --output text; done
CloudTrail, servicequotas.amazonaws.comQuota increase requests, logged as RequestServiceQuotaIncrease. History for a Region: aws service-quotas list-requested-service-quota-change-history --service-code ec2 --region <region>
GuardDutyMining findings: CryptoCurrency:EC2/BitcoinTool.B, CryptoCurrency:EC2/BitcoinTool.B!DNS, Impact:EC2/BitcoinDomainRequest.Reputation
GuardDuty Runtime MonitoringMining findings from the agent: CryptoCurrency:Runtime/BitcoinTool.B, Impact:Runtime/CryptoMinerExecuted, Impact:Runtime/BitcoinDomainRequest.Reputation
BillingEC2 cost by Region and instance type for the incident window, in Cost Explorer. Cost Anomaly Detection alerts, if configured, often show the start time

Contain

#Item
1Contain the identity that launched the instances, using credential leak or account takeover
2Snapshot one instance per launch pattern as evidence
3Cancel the attacker's Spot requests before you stop or terminate their instances: aws ec2 cancel-spot-instance-requests --region <region> --spot-instance-request-ids <id>
4Set each attacker Auto Scaling group to zero: aws autoscaling update-auto-scaling-group --region <region> --auto-scaling-group-name <asg> --min-size 0 --max-size 0 --desired-capacity 0
5Stop the attacker's instances: aws ec2 stop-instances --region <region> --instance-ids <id> <id>
6Create a Region deny service control policy (SCP) on aws:RequestedRegion, with global services in NotAction: aws organizations create-policy --content file://region-deny.json --name ir-region-deny --type SERVICE_CONTROL_POLICY --description "<case>"
7Attach the Region deny SCP: aws organizations attach-policy --policy-id <p-id> --target-id <ou-or-account>

Eradicate and recover

#Item
1Terminate the attacker's instances once evidence is captured destructive: aws ec2 terminate-instances --region <region> --instance-ids <id>
2Delete the fleets, Auto Scaling groups, launch templates, key pairs and security groups the attacker created, in every Region
3Reduce quotas the attacker raised, and review quota increase requests still open
4Open an AWS Support case about the unauthorized usage and charges
5Set budget alerts that cover Regions you do not use
Watch out
  • Test the Region deny SCP on one account first. Its NotAction list must keep global services such as IAM, Organizations and STS working. Start from the AWS example policy.
  • Terminating an instance launched by a persistent Spot request reopens the request, which launches a new instance. Cancel the request first.
  • Stopped instances still bill for their EBS volumes and Elastic IP addresses.
Adapts material from Dynamic Incident Response: A Framework for Security Teams by Joshua Wright, © 2026 The Escal Institute of Advanced Technologies, Inc. d/b/a SANS Institute, licensed under CC BY 4.0. Figures reproduced under that license. Changes were made. Not published by, endorsed by, or affiliated with the SANS Institute.