A cryptominer on a server or in a container is rarely the whole incident: it is the loudest sign that someone already has a way in. Mining raises bills and degrades service, but the access path that let it run (an exposed service, a stolen key, a writable image, a container that can escape) can be reused for data theft or ransomware. This template gives [Organisation] a ready-to-adopt response for cryptomining on hosts, virtual machines, containers and Kubernetes clusters, with cost containment and root cause on credentials built in. It is for incident responders, platform and cloud engineers. For the threat itself see the Cryptojacking Guide; where mining was launched through a stolen cloud access key creating new instances, run the Cloud Access Key Leak Playbook alongside this one.
How to use this template
- Replace the placeholders: values in square brackets, such as [Organisation], [SOC on-call] and [4 hours], are for you to set.
- Follow the structure of NIST SP 800-61 Rev. 3: the sections map to detection, response and recovery activities in the CSF 2.0 incident response profile.
- Preserve before you kill: the first instinct is to terminate the miner. Section 4 explains how to stop the cost and the traffic while keeping the evidence that shows how it arrived.
- Scope: mining on existing hosts and workloads. Mining on newly created cloud resources is primarily an access key incident; use both playbooks.
1. Scope and triggers
1.1 This playbook applies to unauthorised use of [Organisation]'s compute for cryptocurrency mining (MITRE ATT&CK T1496.001 Compute Hijacking) on Linux and Windows servers, cloud virtual machines, container hosts, Kubernetes clusters, CI runners and managed notebook or ML platforms.
1.2 Triggers include:
| Trigger | Example source | Initial severity |
|---|---|---|
| Cloud threat detection finding for mining | AWS GuardDuty CryptoCurrency:EC2/BitcoinTool.B, CryptoCurrency:EC2/BitcoinTool.B!DNS, Impact:EC2/BitcoinDomainRequest.Reputation; Google Security Command Center Execution: Cryptomining Hash Match, Execution: Cryptomining YARA Rule, Malware: Bad Domain | High |
| EDR or runtime security alert for a known miner or mining behaviour | Endpoint or container runtime sensor | High |
| DNS or network connection to known mining pools, or Stratum protocol traffic | DNS logs, proxy, NDR | High |
| Sustained unexplained CPU or GPU saturation | Monitoring, Kubernetes metrics | Medium until confirmed |
| Billing or quota anomaly on existing resources | Cloud cost alerts | Medium until confirmed |
| Precursor finding on the same identity or project | Google SCC Account_Has_Leaked_Credentials, Initial Access: Dormant Service Account Action | Raise to High if mining follows |
1.3 Raise severity to Critical if the affected host or cluster holds production data, privileged credentials, or if there is evidence of container escape (T1611) or access beyond the mining workload.
2. Roles and contacts
| Role | Responsibility | Contact |
|---|---|---|
| Incident lead | Owns severity, decisions and timeline | [SOC on-call] |
| Platform or cluster owner | Isolation, node cordoning, workload rebuild | [Team, on-call number] |
| Cloud security | Cloud logs, IAM review, key revocation | [Name] |
| Forensics | Memory and disk capture, analysis | [Internal or retainer contact] |
| Finance or FinOps | Cost impact, provider billing dispute | [Name] |
| Application owner | Service impact and recovery testing | [Name] |
| Cloud provider support | Abuse reports, billing adjustment requests | [Support plan and case route] |
Use team mailing lists, not individuals, for cloud provider security contacts and monitor them around the clock; Google lists this as a requirement of its cryptomining protection programme.
3. Detection and triage
- Confirm it is unauthorised. Check with the owner that the workload is not sanctioned (some research, blockchain or test workloads mine legitimately). If it is legitimate, record it and add a scoped suppression, for example a GuardDuty suppression rule on finding type and instance ID.
- Identify the unit: host, instance ID, container image and digest, pod, namespace, node, service account, and the cloud identity attached to the instance or pod.
- Establish how it started. Typical entry points: an exploited internet-facing service (T1190), weak or exposed SSH and remote services, an unauthenticated container or Kubernetes API or dashboard, a malicious or poisoned image (T1525), stolen credentials (T1078), or a CI job.
- Look for persistence: cron entries (T1053.003), new systemd services (T1543.002), added SSH authorized keys (T1098.004), modified ld.so.preload or other hiding (T1574.006, T1014), privileged DaemonSets or new deployments (T1610), and use of kubectl exec (T1609).
- Check credential exposure. Did the workload or host have access to the instance metadata service (T1552.005), mounted service account tokens, environment variables or files with secrets (T1552.001)? List every credential reachable from the compromised context.
- Set severity using 1.3 and open the incident record.
4. Containment
Contain in this order so that cost and spread stop before evidence is lost.
- Cut the network, not the power. For a cloud VM, attach an isolation security group that allows only your forensics IPs and remove all others; AWS notes that existing tracked connections survive a security group change, so add network ACL denies for the pool and command and control addresses. For on-premises hosts, isolate through EDR or switch port.
- Capture volatile evidence: memory, process list with command lines, network connections and the miner binary or script, then snapshot disks and record the image digest. See the Container and Kubernetes Forensics Guide and the Linux Forensics Guide.
- Kubernetes: cordon the node, label the pod for quarantine and apply a deny-all network policy to it rather than deleting it; scale down the owning deployment or DaemonSet only after capture. Check whether the attacker created other workloads in other namespaces.
- Stop the cost: after capture, stop or scale to zero the affected compute. Put temporary quotas or limits on the affected project, namespace or account so that a second wave cannot start.
- Contain the identities: revoke or rotate any credential reachable from the compromised context, starting with cloud roles and Kubernetes service account tokens. If the attached cloud role was used from outside the workload, switch to the cloud access key playbook immediately.
- Block indicators: pool domains and IPs at DNS and egress, image digests at the registry and admission controller.
5. Eradication
- Rebuild, do not clean. Replace affected hosts and nodes from known-good images; attackers commonly add hiding and persistence that manual cleaning misses.
- Fix the entry point: patch the exploited service, close the exposed API or dashboard, enforce authentication, remove the poisoned image and rebuild from source.
- Remove persistence everywhere it could be: cron, systemd, SSH keys, cluster workloads, webhooks, CI secrets and registry images pushed during the window.
- Replace secrets, not just rotate them: where a static secret was found in an image, pod spec or environment, replace it with workload identity or short-lived credentials. The Tesla Kubernetes cryptojacking case combined an unauthenticated console with cloud access keys stored in a pod, which turned a mining incident into a data exposure.
- Hunt fleet-wide: search for the same binary hash, image digest, pool domains and persistence artefacts across all hosts and clusters.
6. Recovery
- Redeploy workloads from verified images with resource requests and limits, and namespace quotas, so that unexpected consumption is capped.
- Restore services in a monitored state, with heightened alerting on the affected identities, pool indicators and resource use for [30 days].
- Confirm cloud spend has returned to baseline and that no resources remain in other regions or projects.
- Rollback: if the rebuilt service fails, roll back to the previous known-good release, never to the compromised instance or image.
- Close the incident only when the entry point is fixed and every reachable credential has been rotated or replaced.
7. Communication and notification
- Internal: service owners, platform teams and leadership, with impact, cost estimate and expected recovery time.
- Cloud provider: open a support case; providers may review charges caused by abuse, but this is at their discretion and depends on your evidence and the controls you had in place.
- Customers and regulators: mining alone rarely triggers personal data notification, but if the investigation shows data access, or the reachable credentials could read personal data and access cannot be ruled out, refer to legal for a notification decision under the incident response plan.
- Upstream: if a public image or package carried the miner, report it to the registry or project maintainers.
8. Post-incident review
Record time from first mining activity to detection, detection to containment, total compute cost, entry point, credentials reachable and whether any were used outside the workload. Ask three questions: why the entry point was exposed, why the workload could reach the credentials it could, and why resource limits did not cap the impact. Feed fixes into hardening backlogs and detection rules.
Implementation guidance
Decision guidance
| Question | If yes | If no |
|---|---|---|
| Did mining run on resources created by an identity, rather than on an existing workload? | Treat as a credential compromise first: cloud access key playbook leads | This playbook leads |
| Could the workload reach production data or privileged credentials? | Critical; full forensics and credential rotation | High; rebuild and fix entry point |
| Is the node shared with other tenants or workloads? | Assume possible escape; rebuild the node and review neighbours | Rebuild the workload only |
| Is evidence needed for legal or insurance purposes? | Full capture with chain of custody before stopping | Capture process, binary and image digest at minimum |
Small and large organisations
- Small teams: enable the provider's managed threat detection and billing alerts, keep this playbook printed with the isolation steps, and rebuild rather than investigate deeply unless credentials were reachable.
- Large estates: automate isolation (security group swap, node cordon) from high-confidence findings, keep forensic capture tooling ready on every cluster, and track mining incidents as a measure of exposed attack surface.
Metrics
- Mean time from first mining activity to detection, and from detection to network isolation.
- Cost per incident and cost avoided by quotas.
- Percentage of incidents with a confirmed root cause.
- Percentage of incidents where reachable credentials were rotated within [24 hours].
- Share of workloads with resource limits and namespace quotas.
Where identity fits
Most container and host mining cases end with a non-human identity question: what could the workload's identity do? A pod's mounted service account token, a node's cloud instance role, CI runner secrets and registry push credentials are all reachable from a compromised workload. Before closing, list each one, confirm from cloud and cluster audit logs whether it was used from anywhere other than its normal workload, and reduce its permissions so that the next compromise reaches less. See the Kubernetes Audit Log Detection Guide.
Evidence to preserve
- Memory image and process list with command lines from the affected host or node.
- Miner binary or script, its configuration (pool address and wallet), and file hashes.
- Disk snapshots, container image digest and the pod or deployment specification.
- Cloud audit logs, Kubernetes audit logs, DNS and flow logs from [14 days] before first activity.
Framework mapping
| Area | Reference |
|---|---|
| Incident response | NIST SP 800-61 Rev. 3; NIST SP 800-53 Rev. 5 IR-4 Incident Handling |
| Monitoring | NIST SP 800-53 Rev. 5 SI-4; NIST CSF 2.0 DE.CM-09 |
| Techniques | MITRE ATT&CK v20 T1496.001, T1190, T1610, T1609, T1611, T1525, T1552.005 |
| Container controls | See the NIST SP 800-190 Container Security Guide |
References
- NIST: SP 800-61 Rev. 3 Incident Response Recommendations and Considerations for Cybersecurity Risk Management
- MITRE ATT&CK: Compute Hijacking
- AWS: GuardDuty EC2 Finding Types
- AWS: Remediating a Potentially Compromised Amazon EC2 Instance
- Google Cloud: Cryptomining Detection Best Practices
Related NHI Mgmt Group resources: Cryptojacking Guide · Cloud Access Key Leak Playbook · Kubernetes Security Guide · Cloud Incident Response Guide