/
CloudTrail Audit SQS Collector

CloudTrail Audit SQS Collector

[ 1 Purpose ] [ 2 Example tables ] [ 3 Authorize It ] [ 4 Run It ] [ 5 Secure It ] [ 6 Monitor It ]

Purpose

An analyst wants to detect malicious behavior in AWS.  Using the CloudTrail SQS collector, the analyst will find every management and data action taken by AWS principals.  As a result, the analyst will revoke the malicious principal’s role, preventing them from disabling cloud services.

Example tables

Table

Description

Table

Description

cloud.aws.cloudtrail

Actions taken in all AWS resources enabled in CloudTrail.

 

Each AWS service has a fourth level table.

Authorize It

  1. Authorize SQS Data Access.

  2. Add data to the S3 bucket.

    1. If you have an AWS organization, create a trail for the organization. Otherwise, create a trail for an AWS account. “Quick create” is not recommended.

      image-20250129-211200.png

       

    2. Name the trail Devo.

      image-20250116-215451.png
    3. Edit the trail.

    4. Use the existing bucket created in Step 1.

       

    5. Disable SSE-KMS. If you require SSE-KMS, the key resource must be added to the cross account role you crated for Devo.

    6. On the next screen, enable events.

      1. Management events are supported by Devo and recommended for detection of unauthorized changes to AWS resources.

      2. Data events are supported by Devo and recommended for detection of unauthorized access or modification of resources, including S3 data (cloud.aws.cloudtrail.s3) and SNS notifications (cloud.aws.cloudtrail.sns).

      3. Insights events are supported by Devo and are recommended for detecting malicious API activity and API service degradation problems (cloud.aws.cloudtrail.insights).

    7. Create the trail.

       

Run It

In the Cloud Collector App, create an SQS Collector instance using this parameters template, replacing the values enclosed in < >.

{ "inputs": { "sqs_collector": { "id": "<FIVE_UNIQUE_DIGITS>", "services": { "<SERVICE_NAME>": {} }, "credentials": { "aws_cross_account_role": "arn:<PARTITION>:iam::<YOUR_AWS_ACCOUNT_NUMBER>:role/<YOUR_ROLE>", "aws_external_id": "<EXTERNAL_ID>" }, "region": "<REGION>", "base_url": "https://sqs.<REGION>.amazonaws.com/<YOUR_AWS_ACCOUNT_NUMBER>/<QUEUE_NAME>" } } }

Secure It

Combine the CloudTrail service with the GuardDuty service to get threat intelligence from AWS.

The data is in the cloud.aws.cloudtrail.* tables. The fourth level of the tag is the AWS service.

Devo Exchange has a comprehensive content pack which will help you use CloudTrail to secure AWS.

S3 Storage

//Investigating unauthorized deletion //Determine number of resources deleted by each host //A host with an unusual number of deletions may be compromised from cloud.aws.cloudtrail.s3 where eventName = "DeleteObject" group by requestParameters_Host select collectdistinct(jqeval(jqcompile(".[0].ARN"),resources)) as resources, length(resources) as number_deleted

 

IAM Access

/* A compromised Kubernetes principal has been taking action in AWS Identity and Access Management. Get a list of the actions taken. */ from cloud.aws.cloudtrail.iam where userIdentity_principalId = "EXAMPLE:EKS" group by eventName

KMS Cryptography

EC2 Compute

 

CloudTrail

Monitor It

Create an inactivity alert to detect interruptions of transfer of data from the source to the SQS queue using the query

Set the inactivity alert to keep track of the collector_id.