Cloud Threat Hunting - Persistence

--- ## Cloud Threat Hunting - Persistence Playbook The playbook is responsible for hunting persistence activity in the cloud. It supports AWS, GCP, and Azure - one at a time. ### Hunting Queries The playbook executes hunting queries for each provider related to each of the following: 1. IAM 2. Compute Resources 3. Compute Functions ### Indicator Extraction If relevant events are found during the search, indicators will be extracted using the `ExtractIndicators-CloudLogging` script. ---

Cloud Incident Response · 23 tasks · 8 inputs · 7 outputs

Inputs

  • cloudProvider — The cloud service provider involved. The supported CSPs are AWS, Azure and GCP.
  • AWSAccessKeyID — The AWS access key ID.
  • username — The username that initiated the API call.
  • region — The region to search for events in. e.g. us-east-1, us-west-2, etc.
  • AzureTimespan — The timespan to limit by the hunting query. e.g., Use 2d for timespan of 2 days Use 1.5h for timespan of 1.5 hour Use 30m for timespan of 30 minutes
  • AWSTimespan — Date and time in the following format - yyyy-mm-ddThh:mm:ss e.g., 2022-05-29T12:00:00 2021-01-01T12:00:00
  • GCPTimespan — Date in ISO. e.g. 2022-05-29T12:00:00.123Z 2021-01-01T12:00:00.234Z
  • GCPProjectName — The GCP project name.

Outputs

  • CloudIndicators.arn — The ARN.
  • CloudIndicators.access_key_id — The AWS access key ID.
  • CloudIndicators.resource_name — The resource name.
  • CloudIndicators.source_ip — The source IP.
  • CloudIndicators.username — The username used by the attacker.
  • CloudIndicators.event_name — The name of the event.
  • CloudIndicators.user_agent — The user agent used by the attacker.

Commands used

aws-cloudtrail-lookup-events azure-log-analytics-execute-query gcp-logging-log-entries-list

Flowchart

AWS Azure GCP no yes no yes no yes yes Start Start Select cloud provider Select cloud provider AWS AWS Azure Azure GCP GCP Hunt for Compute Instance persistence activity - azure-log-analytics-execute-query Hunt for Compute Instance... azure-log-analytics-execute-q... Hunt for Compute Function persistence activity - azure-log-analytics-execute-query Hunt for Compute Function... azure-log-analytics-execute-q... Hunt for IAM persistence activity - azure-log-analytics-execute-query Hunt for IAM persistence ... azure-log-analytics-execute-q... Fetch events for specified Access Key ID - aws-cloudtrail-lookup-events Fetch events for specifie... aws-cloudtrail-lookup-events Filter Events Filter Events Hunt for Compute Instance persistence activity - Set Hunt for Compute Instance... Set Hunt for Compute Function persistence activity - Set Hunt for Compute Function... Set Hunt for IAM persistence activity - gcp-logging-log-entries-list Hunt for IAM persistence ... gcp-logging-log-entries-list Hunt for Compute Instance persistence activity - gcp-logging-log-entries-list Hunt for Compute Instance... gcp-logging-log-entries-list Hunt for Compute Function persistence activity - gcp-logging-log-entries-list Hunt for Compute Function... gcp-logging-log-entries-list Extract Indicators Extract Indicators Hunt for IAM persistence activity - Set Hunt for IAM persistence ... Set Is Azure Log Analytics enabled? - IsIntegrationAvailable Is Azure Log Analytics en... IsIntegrationAvailable Is AWS - CloudTrail enabled? - IsIntegrationAvailable Is AWS - CloudTrail enabled? IsIntegrationAvailable Is Google Cloud Logging enabled? - IsIntegrationAvailable Is Google Cloud Logging e... IsIntegrationAvailable Extract indicators - ExtractIndicators-CloudLogging Extract indicators ExtractIndicators-CloudLogging Found results? Found results? Done Done