PIVTR-D
ROracle Cloud playbook · Compute and containers

Compromised compute instance

The attacker has a shell or a running process on a compute instance, through a weak password, an exposed service, a stolen SSH key or a vulnerable application. From there the attacker calls the instance metadata service for the instance principal's credentials, installs miners or backdoors, and moves to other instances. Memory carries evidence that a stop erases, so capture memory first and isolate second.

Look here

LogSearch for
Audit, compute and network changesLaunches, power actions, console connections, Run Command jobs and security rule changes: LaunchInstance, UpdateInstance, InstanceAction, TerminateInstance, CreateInstanceConsoleConnection, CreateInstanceAgentCommand, AddNetworkSecurityGroupSecurityRules, UpdateNetworkSecurityGroupSecurityRules, UpdateSecurityList. Confirm the exact event names in your export: oci audit event list -c <compartment-ocid> --start-time <utc> --end-time <utc> --all
Audit, Run CommandCommands the instance owner did not send. The Compute Instance Run Command plugin of Oracle Cloud Agent runs scripts through the CreateInstanceAgentCommand operation. Plain-text output keeps only the last 1 KB and is retained for seven days. Output saved to an Object Storage location is kept until someone deletes it
Web application firewall (WAF) and load balancer logs, if enabledThe entry request. In the WAF log, read action, clientAddr, request.path and requestProtection.matchedRules. In the load balancer access log, read request, clientAdd, backendAddr and backendStatusCode for the instance's address
Vulnerability Scanning findingsCritical findings for the instance and its image. Host scanning needs an image that supports Oracle Cloud Agent: oci vulnerability-scanning vulnerability list -c <compartment-ocid> --severity CRITICAL --all
Vulnerability Scanning, impacted hostsEvery host that has one finding: oci vulnerability-scanning vulnerability list-vulnerability-impacted-hosts --vulnerability-id <id>
Virtual cloud network (VCN) flow logsConnections to unusual destinations, scans of internal addresses, and outbound traffic to mining pools, for the subnet or VNIC. Flow logs exist only if they were enabled before the incident
Guest logsSSH and sign-in records inside the instance, such as /var/log/secure on Oracle Linux or the Windows Security log. OCI Audit does not record sessions inside the instance
Instance metadata serviceRequests to 169.254.169.254 that fetch identity and configuration. Version 1 endpoints need no header, and version 2 endpoints need Authorization: Bearer Oracle. The InstanceMetadataRequests metric shows legacy version 1 requests
Cloud GuardProblems for the instance, if Cloud Guard covers the compartment
Instance configurationShape, image, metadata and areLegacyImdsEndpointsDisabled, and changes to ssh_authorized_keys and user_data in the metadata. Run oci compute instance get --instance-id <ocid>
Instance networkAddresses and network security groups of each VNIC: oci compute instance list-vnics --instance-id <ocid>

Contain

#Item
1Record the instance, VNIC and volume details from the commands above before any change. See Evidence
2Capture volatile evidence from the running instance while access still works, using your forensic tooling: process list, network connections and a memory image. A stop clears memory, and NVMe drives are erased when an instance is terminated
3Back up the boot volume: oci bv boot-volume-backup create --boot-volume-id <ocid> --display-name <case-id> --type FULL --wait-for-state AVAILABLE
4Back up every attached block volume: oci bv backup create --volume-id <ocid> --display-name <case-id> --type FULL
5Move the VNIC into a quarantine network security group that has no rules. Setting --nsg-ids replaces the list, so the VNIC leaves its other groups: oci network vnic update --vnic-id <vnic-ocid> --nsg-ids '["<quarantine-nsg-ocid>"]'
6Check the security lists on the VNIC's subnet. The rules that apply are the union of the subnet's security lists and the VNIC's groups, so a permissive security list still allows traffic. If it allows the attacker's path, remove the rules from the security list or move the instance to an isolated subnet
7Block the exploit path while the patch is prepared. Add a WAF request access rule that returns an HTTP response for the exploited path, or remove the ingress rule that exposes the service: oci network nsg rules remove --nsg-id <ocid> --security-rule-ids '["<rule-id>"]'
8End sessions that are already open. Established TCP connections stay tracked for an idle timeout of one day, and a new rule does not cut them. After the memory image is saved, stop the instance: oci compute instance action --instance-id <ocid> --action STOP
9Block the instance principal from using OCI, then follow stolen instance principal credentials. Remove the instance from the matching dynamic group, or change the matching rule: oci iam dynamic-group update --dynamic-group-id <ocid> --matching-rule '<rule>'
10Remove attacker SSH keys from the instance metadata and from authorized_keys on copies of the disk, and review the users who have manage instance-family for the compartment

Eradicate and recover

#Item
1Restore the boot volume backup to a new volume, attach it read-only to a forensic instance in an isolated compartment, and work from the copy: oci bv boot-volume create --availability-domain <ad> -c <compartment-ocid> --boot-volume-backup-id <backup-ocid>
2Find how the attacker got in: exposed ports in security lists and network security groups, weak or reused credentials, vulnerable packages, or a leaked key. Search the other instances in the compartment for the same indicators
3Find every instance built from the same image, then patch or rebuild each one. Repeat per compartment and region, and fix the image itself: oci compute instance list -c <compartment-ocid> --all | jq '.data[] | select(."image-id" == "<image-ocid>") | .id'
4Rebuild from a known-good image. Launch with the instance principal permissions the workload needs and no more
5Rotate every secret the instance stored or could read, including credentials in files and metadata and anything its instance principal could reach
6Require version 2 of the metadata service on instances whose images support it. Check first that no application uses version 1, or the instance can lose connectivity: oci compute instance update --instance-id <ocid> --instance-options '{"areLegacyImdsEndpointsDisabled": true}'
7Enable VCN flow logs for the subnet, and enable Cloud Guard and Vulnerability Scanning for the compartment
8After the case owner releases the evidence, terminate the compromised instance destructive. The CLI default for --preserve-boot-volume is false, so set it to keep the boot volume: oci compute instance terminate --instance-id <ocid> --preserve-boot-volume true
Watch out
  • Network security groups and security lists add together. A quarantine group with no rules blocks nothing that the subnet's security list already allows.
  • Established TCP connections stay tracked until they have been idle for a day. An attacker with an open session keeps it after the rule change, so stop the instance once the memory image is saved.
  • Stopping clears memory. Terminating erases NVMe drives, and the public and private addresses are released eventually.
  • Requiring version 2 of the metadata service adds a header requirement and rejects requests that use the Forwarded headers.

Oracle documentation: security rules, connection tracking and idle timeouts; instance metadata service versions; terminating an instance; details for WAF logs; details for Load Balancer logs; Vulnerability Scanning overview; adding a WAF request control rule; Compute Instance Run Command; OCI CLI reference for network vnic update, bv boot-volume-backup create and compute instance update. Checked September 2026. Rechecked October 2026: every command and the default for preserving the boot volume on terminate against OCI CLI 3.94.2.

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.