CloudTrail Audit SQS Collector
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 |
---|---|
cloud.aws.cloudtrail | Actions taken in all AWS resources enabled in CloudTrail. |
| Each AWS service has a fourth level table. |
Authorize It
Authorize SQS Data Access.
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.
Name the trail
Devo
.Edit the trail.
Use the existing bucket created in Step 1.
Disable SSE-KMS. If you require SSE-KMS, the key resource must be added to the cross account role you crated for Devo.
On the next screen, enable events.
Management events are supported by Devo and recommended for detection of unauthorized changes to AWS resources.
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
).Insights events are supported by Devo and are recommended for detecting malicious API activity and API service degradation problems (
cloud.aws.cloudtrail.insights
).
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
.