Amazon Detective automatically collects log data from AWS resources and uses machine learning, statistical analysis, and graph theory to build interactive visualizations for security investigations. Attackers target Detective to destroy forensic evidence.
Detective builds a behavior graph from ingested data using ML and statistical analysis, linking entities (IP addresses, IAM principals, AWS accounts) with their activities. Core sources: CloudTrail, VPC Flow Logs, GuardDuty findings. Optional: EKS Audit Logs, Security Hub findings.
Attack note: Deleting the behavior graph permanently destroys up to 1 year of correlated forensic data that cannot be recovered.
An administrator account creates and manages the behavior graph, invites member accounts, and conducts investigations. Member accounts contribute data. In AWS Organizations, a delegated administrator can auto-enable Detective for all accounts.
Attack note: Detective is an investigation tool, not a detection tool. Disabling it does not stop alerts but destroys the forensic graph data needed to investigate incidents.
Detective is an investigation tool, not a detection tool. Disabling it does not stop alerts (GuardDuty still fires), but it destroys the forensic graph data needed to investigate incidents. Attackers who delete the behavior graph eliminate up to 1 year of correlated investigation data.
aws detective list-graphsaws detective list-members \
--graph-arn arn:aws:detective:us-east-1:111122223333:graph:a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4aws detective list-datasource-packages \
--graph-arn arn:aws:detective:us-east-1:111122223333:graph:a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4aws detective list-organization-admin-accountsaws detective list-investigations \
--graph-arn arn:aws:detective:us-east-1:111122223333:graph:a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4Key insight: SearchGraph provides cross-account reconnaissance across all member accounts, making the administrator account a high-value target.
aws detective delete-graph \
--graph-arn arn:aws:detective:us-east-1:111122223333:graph:a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4aws detective delete-members \
--graph-arn arn:aws:detective:us-east-1:111122223333:graph:a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 \
--account-ids 444455556666 777788889999aws detective disassociate-membership \
--graph-arn arn:aws:detective:us-east-1:111122223333:graph:a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4aws detective disable-organization-admin-accountaws detective update-investigation-state \
--graph-arn arn:aws:detective:us-east-1:111122223333:graph:a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 \
--investigation-id 123456789012345678901 \
--state ARCHIVEDaws detective get-investigation \
--graph-arn arn:aws:detective:us-east-1:111122223333:graph:a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 \
--investigation-id 123456789012345678901{
"Effect": "Allow",
"Action": "detective:*",
"Resource": "*"
}Full access allows deleting behavior graphs, removing members, and destroying all forensic investigation data.
{
"Effect": "Allow",
"Action": [
"detective:Get*",
"detective:List*",
"detective:BatchGet*",
"detective:SearchGraph",
"detective:DescribeOrganizationConfiguration"
],
"Resource": "*"
}Read-only access for security analysts to investigate findings without modification rights.
{
"Sid": "PreventDetectiveTampering",
"Effect": "Deny",
"Action": [
"detective:DeleteGraph",
"detective:DeleteMembers",
"detective:DisableOrganizationAdminAccount",
"detective:DisassociateMembership",
"detective:UpdateInvestigationState"
],
"Resource": "*"
}Organization SCP to prevent deleting behavior graphs or removing member accounts.
{
"Effect": "Allow",
"Action": [
"detective:DeleteGraph",
"detective:DeleteMembers",
"detective:DisassociateMembership"
],
"Resource": "*"
}These permissions allow destroying the behavior graph and all correlated investigation data.
Centralize Detective management so member accounts cannot disable it or leave the behavior graph.
aws detective enable-organization-admin-account \
--account-id 123456789012Use Service Control Policies to deny Detective destructive actions across all member accounts.
"Action": ["detective:DeleteGraph", "detective:DeleteMembers", "detective:DisableOrganizationAdminAccount"]Detective must be enabled per-region. Ensure behavior graphs exist in every active region.
for region in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do
aws detective create-graph --region $region --tags Environment=Production
doneCreate EventBridge rules to alert on destructive Detective API calls via CloudTrail.
aws events put-rule --name "DetectiveTamperingAlert" \
--event-pattern '{"source":["aws.detective"],"detail-type":["AWS API Call via CloudTrail"],"detail":{"eventName":["DeleteGraph","DeleteMembers"]}}'Ensure new accounts are automatically added to the behavior graph.
aws detective update-organization-configuration \
--graph-arn GRAPH_ARN \
--auto-enableEnable optional data source packages (EKS Audit, Security Hub findings) for maximum investigation coverage.
aws detective update-datasource-packages \
--graph-arn GRAPH_ARN \
--datasource-packages EKS_AUDIT ASFF_SECURITYHUB_FINDINGSearchGraph provides cross-account visibility into all member account activity. Restrict it to authorized security investigators only.
Set up alarms for DeleteGraph, DeleteMembers, DisableOrganizationAdminAccount, and UpdateInvestigationState events.
Amazon Detective Security Card • Toc Consulting
Always obtain proper authorization before testing