AWS GuardDuty
AWS GuardDuty findings are alerts generated by the service when it detects potential security threats or unusual behavior in your AWS environment. You can integrate SIEM (InsightIDR) with AWS GuardDuty to receive third-party alerts. AWS GuardDuty produces data in the form of EventBridge events, which are then sent to SIEM (InsightIDR) using an Amazon Simple Queue Service (SQS) queue.
There are two ways to send data from your AWS GuardDuty account to SIEM (InsightIDR): event collection through the Cloud or through an on-premises Rapid7 Collector.
MDR Customers
If you are an MDR customer, you must select the cloud connection method.
To set up AWS GuardDuty:
- Read the requirements and complete any prerequisite steps.
- Configure AWS GuardDuty to send data to SIEM (InsightIDR).
- Configure SIEM (InsightIDR) to collect data from the event source.
- Test the configuration.
You can also:
Visit the third-party vendor's documentation
For the most accurate information about preparing your event source product for integration with SIEM (InsightIDR), we recommend that you visit the Amazon GuardDuty product documentation .
Requirements
Before SIEM (InsightIDR) can start ingesting data from AWS GuardDuty, you must:
- Set up and enable AWS GuardDuty
- Set up EventBridge events
To learn more about EventBridge events, refer to the Amazon EventBridge user guide .
Configure AWS GuardDuty to send data to SIEM (InsightIDR)
To ensure SIEM (InsightIDR) can retrieve data from AWS GuardDuty, there are a few components that must be set up within the AWS Management Console.
Task 1: Enable AWS GuardDuty
From the AWS Management Console, go to GuardDuty > Enable GuardDuty. For detailed instructions, see the AWS documentation .
Task 2: Generate the AWS Key
To generate the AWS Key:
- Go to Key Management Service > Create a key and select:
- Key type: Symmetric
- Key usage: Encrypt and decrypt
- Key spec:
SYMMETRIC_DEFAULT - Region: the same region as your SQS queue and your GuardDuty detector
Asymmetric and HMAC keys cannot be used for SQS server-side encryption. For detailed instructions, see the AWS documentation.
Do not add the Rapid7 ingestion IAM user as a Key Administrator
On the console’s Key administrators step, select a human administrator or an administrative role — never the IAM user you create in Task 4. A KMS key policy is authoritative on its own, so listing the ingestion user as a key administrator grants it kms:PutKeyPolicy and kms:ScheduleKeyDeletion on the key protecting your findings. The ingestion user needs only the Allow use of the key statement added in Task 5.
Task 3: Set up the SQS queue
The SQS queue allows AWS GuardDuty to send data to and from SIEM (InsightIDR), which will read and remove messages once they are processed, as it polls periodically.
- Go to Simple Queue Service > Create queue and create a new SQS queue, ensuring the queue is dedicated for use by SIEM (InsightIDR).
- Under Type, select Standard.
- Under Encryption, choose one:
- SSE-SQS (Amazon SQS key) — Recommended. Amazon SQS manages the key. You can skip Task 2 and Task 5. The Rapid7 IAM user needs no KMS permissions, and EventBridge delivery works with the default target permissions.
- SSE-KMS (customer-managed key) — Select this option only if your policy requires a customer-managed key. You must also complete Task 2 and Task 5, and grant KMS permissions to EventBridge as described in Task 6.
- Confirm the queue is in the same region as your GuardDuty detector and your EventBridge rule.
- Under Dead-letter queue, configure a redrive policy so findings that cannot be processed are retained rather than silently discarded after the retention period.
- Set Receive message wait time to
20seconds to enable long polling. - Click Create queue.
Store the queue URL in a secure place for later use when configuring the AWS GuardDuty event source in SIEM (InsightIDR).
The queue URL includes your account ID and has this form:
https://sqs.<region>.amazonaws.com/<account-id>/<queue-name>Grant EventBridge permission to send messages to the queue
A new SQS queue has an empty access policy. EventBridge can write to the queue only after you add a statement for the EventBridge service principal. Without this statement, EventBridge fails to deliver findings without reporting an error: the rule reports invocations, SIEM (InsightIDR) shows no errors, and the queue stays empty.
The EventBridge console usually adds this statement for you. If you use the CLI, CloudFormation, Terraform, or a pre-existing queue, nothing adds the statement and nothing reports that it is missing.
Open the queue and edit Access policy. Do not replace the whole policy.
Add this statement to the existing Statement array:
{
"Sid": "AllowEventBridgeToSendMessages",
"Effect": "Allow",
"Principal": { "Service": "events.amazonaws.com" },
"Action": "sqs:SendMessage",
"Resource": "arn:aws:sqs:<region>:<account-id>:<queue-name>",
"Condition": {
"ArnEquals": {
"aws:SourceArn": "arn:aws:events:<region>:<account-id>:rule/<rule-name>"
}
}
}The aws:SourceArn condition restricts writes to your specific rule. If you haven’t created the rule yet, omit the condition and add it after you create the rule in Task 6.
Task 4: Create the IAM Policy and IAM User
The IAM policy and user you create will be used in making HTTP requests to an SQS queue.
- Go to IAM > Policies > Create policy.
- Add this to the JSON of the policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ConsumeGuardDutyFindingsQueue",
"Effect": "Allow",
"Action": [
"sqs:ReceiveMessage",
"sqs:DeleteMessage"
],
"Resource": "arn:aws:sqs:<region>:<account-id>:<queue-name>"
},
{
"Sid": "DecryptQueueMessages",
"Effect": "Allow",
"Action": [
"kms:Decrypt"
],
"Resource": "arn:aws:kms:<region>:<account-id>:key/<key-id>"
}
]
}- Omit the DecryptQueueMessages statement if your queue uses SSE-SQS rather than a customer-managed KMS key.
- These permissions are not required: Do not add them while troubleshooting:
sqs:SendMessageandkms:GenerateDataKey*- Write permissions. The event source only reads and deletes. Granting them allows this credential to publish arbitrary messages into SIEM (InsightIDR).sqs:ListQueues- No effect. Amazon SQS does not support resource-level permissions for this action, so scoping it to a queue ARN never matches.sqs:ChangeMessageVisibility- Not used by the event source.
- Go to Users, create an IAM User. During user creation, attach the policy you created. This user should have permissions to make
receiveMessageanddeleteMessagecalls from the SQS queue. Learn more information about IAM in the AWS documentation . - Create an access key for the user.
- Store the IAM user’s Access Key ID and Secret Access Key in a secure place for later use when configuring the AWS GuardDuty event source in SIEM (InsightIDR).
There is no Role ARN to store
This task creates an IAM user, not a role. When you configure the event source, leave the Role ARN field empty. The field is only for the optional assumed-role method in Task 4b, and it requires a role ARN in the form arn:aws:iam::<account-id>:role/<role-name>. If you enter an IAM user ARN, the connection test fails with the error Boto3 raised following error during assume role: AccessDenied.
Limit user access
Because this IAM User will have access to your data, it is recommended to limit access.
Task 4b (optional): Use an assumed role instead of access keys
Complete this task only if your policy requires the event source to assume a role. If you authenticate with the IAM user access keys from Task 4, skip this task.
To use an assumed role:
- Create an IAM role in your account.
- Attach the policy from Task 4 to the role, not the user.
- Set the role’s trust policy to allow your IAM user to assume it, with an
sts:ExternalIdcondition, and record the External ID you choose. - Grant the IAM user
sts:AssumeRoleon the role ARN. - Enter the role ARN in Role ARN and the External ID in External ID when you configure the event source.
Task 5: Set up encrypted SQS queue user permissions
Users need to have the relevant permissions that will allow them to access the queue created in Task 3.
The EventBridge key statement works only without an execution role
The AllowEventBridgeToUseTheKey statement takes effect only if your EventBridge target has no execution role. If a role is attached to the target, EventBridge assumes that role instead of using the service principal, and this statement is never evaluated. The console attaches an execution role to SQS targets by default. In that case, this statement has no effect. For details, see Task 6.
If the SQS queue is encrypted with a customer-managed key, edit the key policy created earlier in AWS Key Management Service. Do not replace the whole policy, because doing so removes the root Enable IAM User Permissions statement and can leave the key unmanageable. For more information on adding policy keys, see the AWS documentation .
Add both of these statements to the existing Statement array of the key policy:
{
"Sid": "AllowRapid7ToUseTheKey",
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::<account-id>:user/<iam-user-name>" },
"Action": [
"kms:Decrypt",
"kms:DescribeKey"
],
"Resource": "*"
},
{
"Sid": "AllowEventBridgeToUseTheKey",
"Effect": "Allow",
"Principal": { "Service": "events.amazonaws.com" },
"Action": [
"kms:GenerateDataKey*",
"kms:Decrypt"
],
"Resource": "*"
}The KMS key must be in the same region as the SQS queue.
Task 6: Create an EventBridge Event rule
EventBridge takes events from AWS GuardDuty and moves them into the SQS queue that SIEM (InsightIDR) uses for its request calls.
- Go to Amazon EventBridge > Rules to create a new rule with the following event pattern. For more detailed instructions, see the AWS documentation
{
"source": ["aws.guardduty"],
"detail-type": ["GuardDuty Finding"]
}- Create the rule on the default event bus, because GuardDuty publishes findings there and a custom event bus receives nothing. Create the rule in the same region as your GuardDuty detector and your SQS queue.
- Under Targets, select SQS queue, and then select the queue you created in Task 3.
Check the target's execution role
When you add an SQS target, the EventBridge console may create and attach a new IAM service role with a name like Amazon_EventBridge_Invoke_Sqs_<id>. That role is granted sqs:SendMessage only and has no KMS permissions. If your queue uses a customer-managed KMS key, every delivery fails.
This is a known cause of the failure where everything is configured but the queue stays empty. While the auto-created role is attached, EventBridge reports failed invocations and delivers no messages. Nothing in SIEM (InsightIDR) reports this problem.
- Choose one:
- Option A (recommended) - Do not use an execution role. EventBridge then authorizes deliveries using the queue access policy from Task 3 and the key policy from Task 5.
- Option B - Keep the execution role and attach this statement to it:
{
"Effect": "Allow",
"Action": [ "kms:GenerateDataKey*", "kms:Decrypt" ],
"Resource": "arn:aws:kms:<region>:<account-id>:key/<key-id>"
}Leave the target’s input as Matched events. Do not configure an input transformer. SIEM (InsightIDR) parses the complete EventBridge envelope, which contains these fields: version, id, detail-type, source, account, region, and detail. Forwarding only detail breaks parsing.
Configure a dead-letter queue on the target so failed deliveries are retained instead of lost.
For troubleshooting information, read the Amazon EventBridge documentation .
Task 7: Verify delivery in AWS
Confirm the AWS side works before you configure the event source. This separates AWS misconfiguration from SIEM (InsightIDR) configuration.
- Go to GuardDuty > Settings > Generate sample findings.
- In the EventBridge console, open your rule and check its Monitoring metrics:
Invocationsshould be greater than zero.FailedInvocationsmust be zero. A non-zero value means the target is rejecting deliveries. Check the target’s execution role and KMS permissions in Task 6.
- In the SQS console, open the queue and select Send and receive messages > Poll for messages, or check the
NumberOfMessagesSentmetric. You should see the sample findings.
Purge the queue before you connect the event source
Sample findings generate false alarms in SIEM (InsightIDR). Use Purge queue, or delete the messages you polled.
Continue only after sample findings arrive in the queue.
Configure SIEM (InsightIDR) to collect data from the event source
After you complete the prerequisite steps and configure the event source to send data, you must add the event source in SIEM (InsightIDR).
Task 1: Select AWS GuardDuty
- From the left menu, click Data Connectors, and navigate to SIEM > Data Collectors. Click Setup Event Source > Add Event Source.
- Do one of the following:
- Search for AWS GuardDuty in the event sources search bar.
- In the Product Type filter, select Third Party Alerts.
- Select the AWS GuardDuty event source tile.
Task 2: Set up your collection method
There are two methods of collecting data from AWS GuardDuty: through a cloud connection or through a collector.
If you are an MDR customer, you must select the cloud connection method.
Use the Cloud Connection method (recommended)
New credentials are required for cloud event sources
You must create new credentials to create a cloud connection with this event source. You cannot reuse existing on-premise credentials.
- In the Add Event Source panel, select Run On Cloud.
- Name the event source. This will become the name of the log that contains the event data in Log Search.
- Optionally, select the option to send unparsed data.
- Select Add a New Connection.
- In the Create a Cloud Connection screen, enter a name for the new connection.
- In the Region field, enter the AWS region you want to use for request.
- Optionally, in the Role ARN field, enter an AWS IAM role ARN in the form
arn:aws:iam::<account-id>:role/<role-name>. - Optionally, in the External ID field, enter the External ID you recorded in Task 4b.
- In the SQS Queue field, enter the URL that you made note of in the previous section. If you need to find this URL, open the AWS Management Console and go to Amazon SQS > Queues. Then, select the URL of the queue that you previously created and copy.
- In the AWS Access Key ID field, add a new credential:
- Name your credential.
- Describe your credential.
- Select the credential type.
- Enter the AWS Access Key ID that you obtained in the previous section, Configure AWS GuardDuty to send data to SIEM (InsightIDR).
- In the AWS Secret Access Key field, add a new credential:
- Name your credential.
- Describe your credential.
- Select the credential type.
- Enter the AWS Secret Access Key that you obtained in the previous section, Configure AWS GuardDuty to send data to SIEM (InsightIDR).
- Select Save Connection.
- Select Save.
Leave the Role ARN field empty for access key authentication
If you authenticate with the IAM user access keys from Task 4, leave the Role ARN field empty. If you enter an IAM user ARN, the connection fails with the error Boto3 raised following error during assume role: AccessDenied. Use this field only with the assumed-role method in Task 4b.
AWS GuardDuty event source supports the usage of assumed roles
For the event source to assume a role, you must provide the Role ARN, the AWS Region, and the External ID if applicable. This assumed role must have the sqs:ReceiveMessage and sqs:DeleteMessage permissions from the policy example in Task 4, and kms:Decrypt on the key if the queue uses a customer-managed KMS key. Attach the policy to the role, not the user. For more details on the assuming of roles, refer to the AWS IAM documentation .
Use the Collector method
To configure the new event source in SIEM (InsightIDR):
- Select your collector.
- Select an event source type.
- Name your event source.
- Select if you want to send unparsed data.
- Select an AWS Authentication option.
- Select your AWS GuardDuty credentials, or optionally create a new credential. The credentials you enter will be the access key and secret key that corresponds to an AWS IAM User that has permissions to make
receiveMessageanddeleteMessagecalls from the above SQS queue.- Access Key: the username you created with IAM permissions
- Secret Key: the password you created that corresponds with the username with IAM permissions
- Enter the SQS Queue URL. This is visible when you select the queue in the AWS console. This will look similar to:
https://sqs.us-east-1.amazonaws.com/111122223333/my-guardduty-queue. The URL includes your AWS account ID. - You can instead choose to use EC2 IAM Roles.
- Click Save.
Verify that data flows after you save the connection
Saving the connection validates connectivity, not authorization. It does not verify your SQS or KMS permissions, your queue URL, or that EventBridge can write to the queue. With Role ARN empty, the connection check makes no authenticated AWS call, so it passes even with invalid keys or no queue permissions. To confirm ingestion, complete Task 7 and the steps in Test the configuration.
ß
Test the configuration
After you set up the configuration, when GuardDuty produces an alert, the alert will go to the SQS queue through EventBridge.
GuardDuty publishes newly generated findings to EventBridge in near real time, and you can’t change this. GuardDuty aggregates subsequent occurrences of an existing finding and publishes them on a schedule that defaults to every 6 hours. You can change this schedule to every 15 minutes or every 1 hour under GuardDuty > Settings. For SIEM (InsightIDR), set the schedule to 15 minutes.
In a multi-account setup, only the delegated GuardDuty administrator can change this frequency. Member accounts inherit it.
A test based on a recurring finding can show nothing for up to 6 hours. To test promptly, use Generate sample findings, which produces new findings.
If you have no findings yet, generate sample findings and verify delivery as described in Task 7. Purge the queue before you continue.
The event type that SIEM (InsightIDR) parses from this event source, for both methods, is GuardDuty Findings.
To test that event data is flowing into SIEM (InsightIDR):
- From the Data Collection Management page, open the Event Sources tab.
- Find the event source you created and click View raw log. If the Raw Logs tab displays raw log entries, logs are successfully flowing to the Collector or Cloud connection.
- Open Log Search.
Next, verify that log entries are appearing in Log Search:
- Click Logs in the left menu, and navigate to SIEM > Log Search.
- In the Log Search filter panel, search for the event source you named in step 4 of Configure SIEM (InsightIDR) to collect data from the event source. GuardDuty logs should flow into this log set:
- Third Party Alerts
- Select the log set and the logs within them.
- Set the time range to Last 10 minutes and click Run.
The Results table displays all events that flowed into SIEM (InsightIDR) in the last 10 minutes. The displayed keys and values are helpful when you want to build a query and search your logs.
Troubleshoot common issues
Check these common issues if the connection fails or data doesn’t arrive:
| Symptom | Cause and fix |
|---|---|
Connection fails with the error Boto3 raised following error during assume role: AccessDenied | The Role ARN field contains an IAM user ARN. Clear the field. See Task 4 and Use the Cloud Connection method. |
The rule shows Invocations and FailedInvocations, and the queue is empty | The target’s execution role lacks kms:GenerateDataKey* and kms:Decrypt on the customer-managed key. See Task 6. |
The rule shows Invocations, FailedInvocations is zero, and the queue is empty | The queue access policy is missing the events.amazonaws.com statement. See Task 3. |
| The connection saves but no logs arrive | Saving does not validate permissions. Check sqs:ReceiveMessage, sqs:DeleteMessage, and kms:Decrypt. See Task 4. |
| The queue receives nothing for hours, and no errors appear | GuardDuty has not generated new findings, and it publishes updates to existing findings every 6 hours by default. Generate sample findings. |
| Only one region’s findings arrive | Each GuardDuty region needs its own EventBridge rule. See Task 6. |
CloudTrail doesn’t log the SQS ReceiveMessage, DeleteMessage, or SendMessage operations, so you can’t use it to confirm that polling occurs.
To confirm that messages arrive and are consumed, check these CloudWatch metrics:
NumberOfMessagesSent,NumberOfMessagesReceived, andNumberOfEmptyReceivesfor the queueFailedInvocationsfor the EventBridge rule
Sample logs
In Log Search, the log that is generated uses the name of your event source by default. The log appears under the log set: Third Party Alerts.
Here is a typical raw log entry that is created by the event source:
GuardDuty Findings
{
"version": "0",
"id": "c8c4daa7-a20c-2f03-0070-b7393dd542ad",
"detail-type": "GuardDuty Finding",
"source": "aws.guardduty",
"account": "123456789012",
"time": "1970-01-01T00:00:00Z",
"region": "us-east-1",
"resources": [],
"detail": {
"schemaVersion": "2.0",
"accountId": "123456789012",
"region": "us-east-1",
"partition": "aws",
"id": "16afba5c5c43e07c9e3e5e2e544e95df",
"arn": "arn:aws:guardduty:us-east-1:123456789012:detector/123456789012/finding/16afba5c5c43e07c9e3e5e2e544e95df",
"type": "Canary:EC2/Stateless.IntegTest",
"resource": {
"resourceType": "Instance",
"instanceDetails": {
"instanceId": "i-05746eb48123455e0",
"instanceType": "t2.micro",
"launchTime": 1492735675000,
"productCodes": [],
"networkInterfaces": [{
"ipv6Addresses": [],
"privateDnsName": "ip-0-0-0-0.us-east-1.compute.internal",
"privateIpAddress": "0.0.0.0",
"privateIpAddresses": [{
"privateDnsName": "ip-0-0-0-0.us-east-1.compute.internal",
"privateIpAddress": "0.0.0.0"
}],
"subnetId": "subnet-d58b7123",
"vpcId": "vpc-34865123",
"securityGroups": [{
"groupName": "launch-wizard-1",
"groupId": "sg-9918a123"
}],
"publicDnsName": "ec2-11-111-111-1.us-east-1.compute.amazonaws.com",
"publicIp": "11.111.111.1"
}],
"tags": [{
"key": "Name",
"value": "ssh-22-open"
}],
"instanceState": "running",
"availabilityZone": "us-east-1b",
"imageId": "ami-4836a123",
"imageDescription": "Amazon Linux AMI 2017.03.0.20170417 x86_64 HVM GP2"
}
},
"service": {
"serviceName": "guardduty",
"detectorId": "3caf4e0aaa46ce4ccbcef949a8785353",
"action": {
"actionType": "NETWORK_CONNECTION",
"networkConnectionAction": {
"connectionDirection": "OUTBOUND",
"remoteIpDetails": {
"ipAddressV4": "0.0.0.0",
"organization": {
"asn": -1,
"isp": "GeneratedFindingISP",
"org": "GeneratedFindingORG"
},
"country": {
"countryName": "United States"
},
"city": {
"cityName": "GeneratedFindingCityName"
},
"geoLocation": {
"lat": 0,
"lon": 0
}
},
"remotePortDetails": {
"port": 22,
"portName": "SSH"
},
"localPortDetails": {
"port": 2000,
"portName": "Unknown"
},
"protocol": "TCP",
"blocked": false
}
},
"resourceRole": "TARGET",
"additionalInfo": {
"unusualProtocol": "UDP",
"threatListName": "GeneratedFindingCustomerListName",
"unusual": 22
},
"eventFirstSeen": "2017-10-31T23:16:23Z",
"eventLastSeen": "2017-10-31T23:16:23Z",
"archived": false,
"count": 1
},
"severity": 5,
"createdAt": "2017-10-31T23:16:23.824Z",
"updatedAt": "2017-10-31T23:16:23.824Z",
"title": "Canary:EC2/Stateless.IntegTest",
"description": "Canary:EC2/Stateless.IntegTest"
}
}