[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71CNWF0GBG8DBWT3QW2JX5F":3,"skill-same:01M71CNWF0GBG8DBWT3QW2JX5F":93},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":66,"commitSha":67,"skillDirectory":68,"forksCount":14,"repositoryHtmlUrl":69,"repositoryHomepageUrl":6,"ownerHtmlUrl":70,"ownerBlogUrl":6,"ownerDescription":71,"updatedAt":72,"install":73,"resources":86},"01M71CNWF0GBG8DBWT3QW2JX5F","security-data-protect-detect",null,"Detecting data exfiltration attempts from AWS S3 buckets by analyzing CloudTrail S3 data events, VPC Flow Logs, GuardDuty findings, Amazon Macie alerts, and S3 access patterns to identify unauthorized bulk downloads and cross-account data transfers.","DCx7C5\u002Fai-marketplace","DCx7C5","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F42419559?v=4","01M71C01G2AZV3NTNGWAWSHJPP","DC","01M71C01GQW6G50S2BYMS7PP3E",0,"MIT","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fsecurity\u002Fdata\u002Fprotect\u002Fdetect\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"security data protect detect","detect","data","protect","security","access","transfers","detecting","bulk","aws s3","alerts","cm","Bash","vpc","macie","data-exfiltration","threat-detection","exfiltration","logs","cybersecurity","2026-11-10 10:12:30",false,"---\nname: security-data-protect-detect\ndescription: Detecting data exfiltration attempts from AWS S3 buckets by analyzing CloudTrail S3 data events, VPC Flow Logs, GuardDuty findings, Amazon Macie alerts, and S3 access patterns to identify unauthorized bulk downloads and cross-account data transfers.\ndomain: cybersecurity\nsubdomain: cloud-security\ntags:\n- cloud-security\n- aws\n- s3\n- data-exfiltration\n- guardduty\n- macie\n- threat-detection\nnist_csf:\n- PR.IR-01\n- ID.AM-08\n- GV.SC-06\n- DE.CM-01\nmodel: sonnet\nmaxTurns: 20\ntools: [Read, Bash, Glob, Grep]\nmitre_attack:\n- T1041\n- T1059\n- T1530\n- T1562.001\ncapec: []\n---\n\n# Detecting S3 Data Exfiltration Attempts\n\n## When to Use\n\n- When GuardDuty detects anomalous S3 access patterns such as bulk downloads from unusual IPs\n- When investigating suspected data breach involving S3-stored sensitive data\n- When building detection rules for S3 data loss prevention monitoring\n- When responding to Macie alerts about sensitive data being accessed or moved\n- When compliance requires monitoring and logging of all access to classified data stores\n\n**Do not use** for preventing data exfiltration (use S3 bucket policies, VPC endpoints, and SCPs), for data classification (use Amazon Macie discovery jobs), or for network-level exfiltration detection (use VPC Flow Logs with network analysis tools).\n\n## Prerequisites\n\n- CloudTrail configured with S3 data event logging (`GetObject`, `PutObject`, `CopyObject`)\n- GuardDuty enabled with S3 Protection feature activated\n- Amazon Macie enabled for sensitive data discovery in target buckets\n- CloudWatch Logs or Athena for querying CloudTrail logs at scale\n- VPC endpoint policies configured for S3 access monitoring\n\n## Workflow\n\n### Step 1: Enable S3 Data Event Logging in CloudTrail\n\nConfigure CloudTrail to capture all S3 object-level operations for forensic analysis.\n\n```bash\n# Enable S3 data events on an existing trail\naws cloudtrail put-event-selectors \\\n  --trail-name management-trail \\\n  --event-selectors '[{\n    \"ReadWriteType\": \"All\",\n    \"IncludeManagementEvents\": true,\n    \"DataResources\": [{\n      \"Type\": \"AWS::S3::Object\",\n      \"Values\": [\"arn:aws:s3:::sensitive-data-bucket\u002F\", \"arn:aws:s3:::customer-records\u002F\"]\n    }]\n  }]'\n\n# Verify data event configuration\naws cloudtrail get-event-selectors --trail-name management-trail \\\n  --query 'EventSelectors[*].DataResources' --output json\n\n# Enable GuardDuty S3 Protection\naws guardduty update-detector \\\n  --detector-id $(aws guardduty list-detectors --query 'DetectorIds[0]' --output text) \\\n  --data-sources '{\"S3Logs\":{\"Enable\":true}}'\n```\n\n### Step 2: Query CloudTrail for Anomalous S3 Access Patterns\n\nAnalyze CloudTrail logs for bulk download activity, unusual access times, and unfamiliar source IPs.\n\n```bash\n# Athena query: Top S3 downloaders by volume in last 24 hours\ncat \u003C\u003C 'EOF'\nSELECT\n  useridentity.arn as principal,\n  sourceipaddress,\n  COUNT(*) as request_count,\n  SUM(CAST(json_extract_scalar(requestparameters, '$.bytesTransferredOut') AS bigint)) as bytes_downloaded\nFROM cloudtrail_logs\nWHERE eventname = 'GetObject'\n  AND eventsource = 's3.amazonaws.com'\n  AND eventtime > date_add('hour', -24, now())\nGROUP BY useridentity.arn, sourceipaddress\nORDER BY request_count DESC\nLIMIT 50\nEOF\n\n# CloudWatch Logs Insights: S3 GetObject requests from unusual IPs\naws logs start-query \\\n  --log-group-name cloudtrail-logs \\\n  --start-time $(date -d \"24 hours ago\" +%s) \\\n  --end-time $(date +%s) \\\n  --query-string '\n    fields @timestamp, userIdentity.arn, sourceIPAddress, requestParameters.bucketName, requestParameters.key\n    | filter eventName = \"GetObject\"\n    | stats count() as requestCount by sourceIPAddress, userIdentity.arn\n    | sort requestCount desc\n    | limit 25\n  '\n\n# Detect cross-account copies (potential exfiltration)\naws logs start-query \\\n  --log-group-name cloudtrail-logs \\\n  --start-time $(date -d \"7 days ago\" +%s) \\\n  --end-time $(date +%s) \\\n  --query-string '\n    fields @timestamp, userIdentity.arn, sourceIPAddress, requestParameters.bucketName\n    | filter eventName in [\"CopyObject\", \"ReplicateObject\", \"UploadPart\"]\n    | filter userIdentity.accountId != \"OUR_ACCOUNT_ID\"\n    | sort @timestamp desc\n    | limit 100\n  '\n```\n\n### Step 3: Review GuardDuty S3 Findings\n\nCheck for GuardDuty S3-specific finding types that indicate exfiltration activity.\n\n```bash\n# List active S3 exfiltration-related findings\naws guardduty list-findings \\\n  --detector-id $(aws guardduty list-detectors --query 'DetectorIds[0]' --output text) \\\n  --finding-criteria '{\n    \"Criterion\": {\n      \"type\": {\n        \"Eq\": [\n          \"Exfiltration:S3\u002FMaliciousIPCaller\",\n          \"Exfiltration:S3\u002FObjectRead.Unusual\",\n          \"Discovery:S3\u002FMaliciousIPCaller.Custom\",\n          \"Discovery:S3\u002FBucketEnumeration.Unusual\",\n          \"UnauthorizedAccess:S3\u002FMaliciousIPCaller.Custom\",\n          \"UnauthorizedAccess:S3\u002FTorIPCaller\",\n          \"Impact:S3\u002FAnomalousBehavior.Delete\"\n        ]\n      }\n    }\n  }' --output json\n\n# Get detailed finding information\naws guardduty get-findings \\\n  --detector-id $(aws guardduty list-detectors --query 'DetectorIds[0]' --output text) \\\n  --finding-ids FINDING_IDS \\\n  --query 'Findings[*].{Type:Type,Severity:Severity,Resource:Resource.S3BucketDetails[0].Name,Action:Service.Action}' \\\n  --output table\n```\n\n### Step 4: Analyze Macie Findings for Sensitive Data Access\n\nReview Macie findings to correlate data sensitivity with access anomalies.\n\n```bash\n# List Macie findings for sensitive data exposure\naws macie2 list-findings \\\n  --finding-criteria '{\n    \"criterion\": {\n      \"category\": {\"eq\": [\"CLASSIFICATION\"]},\n      \"severity.description\": {\"eq\": [\"High\", \"Critical\"]}\n    }\n  }' \\\n  --sort-criteria '{\"attributeName\": \"updatedAt\", \"orderBy\": \"DESC\"}' \\\n  --max-results 25\n\n# Get detailed finding with data classification\naws macie2 get-findings \\\n  --finding-ids FINDING_IDS \\\n  --query 'findings[*].{Type:type,Severity:severity.description,Bucket:resourcesAffected.s3Bucket.name,SensitiveDataTypes:classificationDetails.result.sensitiveData[*].category}' \\\n  --output table\n\n# Run a sensitive data discovery job on target bucket\naws macie2 create-classification-job \\\n  --job-type ONE_TIME \\\n  --name \"exfiltration-investigation\" \\\n  --s3-job-definition '{\n    \"bucketDefinitions\": [{\n      \"accountId\": \"ACCOUNT_ID\",\n      \"buckets\": [\"sensitive-data-bucket\"]\n    }]\n  }'\n```\n\n### Step 5: Build Automated Detection Rules\n\nCreate CloudWatch alarms and EventBridge rules for real-time exfiltration detection.\n\n```bash\n# CloudWatch metric filter for high-volume S3 downloads\naws logs put-metric-filter \\\n  --log-group-name cloudtrail-logs \\\n  --filter-name s3-bulk-download \\\n  --filter-pattern '{$.eventName = \"GetObject\" && $.eventSource = \"s3.amazonaws.com\"}' \\\n  --metric-transformations '[{\n    \"metricName\": \"S3GetObjectCount\",\n    \"metricNamespace\": \"SecurityMetrics\",\n    \"metricValue\": \"1\",\n    \"defaultValue\": 0\n  }]'\n\n# Alarm for anomalous download volume (>1000 objects\u002Fhour)\naws cloudwatch put-metric-alarm \\\n  --alarm-name s3-exfiltration-alert \\\n  --metric-name S3GetObjectCount \\\n  --namespace SecurityMetrics \\\n  --statistic Sum \\\n  --period 3600 \\\n  --threshold 1000 \\\n  --comparison-operator GreaterThanThreshold \\\n  --evaluation-periods 1 \\\n  --alarm-actions arn:aws:sns:us-east-1:ACCOUNT:security-alerts\n\n# EventBridge rule for GuardDuty S3 findings\naws events put-rule \\\n  --name guardduty-s3-exfiltration \\\n  --event-pattern '{\n    \"source\": [\"aws.guardduty\"],\n    \"detail-type\": [\"GuardDuty Finding\"],\n    \"detail\": {\n      \"type\": [{\"prefix\": \"Exfiltration:S3\u002F\"}]\n    }\n  }'\n```\n\n### Step 6: Implement Preventive Controls\n\nDeploy bucket policies and VPC endpoint policies to restrict data movement paths.\n\n```bash\n# VPC endpoint policy restricting S3 access to specific buckets\naws ec2 modify-vpc-endpoint \\\n  --vpc-endpoint-id vpce-ENDPOINT_ID \\\n  --policy-document '{\n    \"Statement\": [{\n      \"Sid\": \"RestrictToOwnBuckets\",\n      \"Effect\": \"Allow\",\n      \"Principal\": \"*\",\n      \"Action\": [\"s3:GetObject\", \"s3:PutObject\"],\n      \"Resource\": [\"arn:aws:s3:::approved-bucket-1\u002F*\", \"arn:aws:s3:::approved-bucket-2\u002F*\"]\n    }]\n  }'\n\n# Bucket policy denying access from outside the VPC\naws s3api put-bucket-policy --bucket sensitive-data-bucket --policy '{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [{\n    \"Sid\": \"DenyNonVpcAccess\",\n    \"Effect\": \"Deny\",\n    \"Principal\": \"*\",\n    \"Action\": \"s3:GetObject\",\n    \"Resource\": \"arn:aws:s3:::sensitive-data-bucket\u002F*\",\n    \"Condition\": {\n      \"StringNotEquals\": {\n        \"aws:sourceVpce\": \"vpce-ENDPOINT_ID\"\n      }\n    }\n  }]\n}'\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| S3 Data Events | CloudTrail object-level logging that captures GetObject, PutObject, DeleteObject, and CopyObject API calls with request details |\n| GuardDuty S3 Protection | Threat detection feature analyzing CloudTrail S3 data events to identify anomalous access patterns and exfiltration attempts |\n| Amazon Macie | Data security service that discovers and classifies sensitive data in S3 and generates findings for data exposure risks |\n| VPC Endpoint Policy | Access control policy on an S3 VPC endpoint that restricts which buckets and actions can be accessed through the endpoint |\n| Data Exfiltration | Unauthorized transfer of data from an organization's S3 storage to an external location controlled by an attacker |\n| Anomalous Behavior Detection | Machine learning-based identification of S3 access patterns that deviate from established baselines for a principal |\n\n## Tools & Systems\n\n- **AWS CloudTrail**: Audit logging of S3 object-level operations for forensic analysis and anomaly detection\n- **Amazon GuardDuty**: ML-based threat detection with S3-specific finding types for exfiltration and unauthorized access\n- **Amazon Macie**: Sensitive data discovery and classification for correlating access anomalies with data sensitivity\n- **Amazon Athena**: SQL query engine for analyzing CloudTrail logs at scale to identify bulk download patterns\n- **CloudWatch Logs Insights**: Real-time log analysis for building detection queries against CloudTrail data\n\n## Common Scenarios\n\n### Scenario: Compromised IAM Credentials Used for Bulk S3 Data Download\n\n**Context**: GuardDuty reports an `Exfiltration:S3\u002FObjectRead.Unusual` finding indicating that a developer's access key is downloading thousands of objects from a sensitive data bucket at 3 AM from an IP address in a foreign country.\n\n**Approach**:\n1. Immediately deactivate the compromised access key\n2. Query CloudTrail for all S3 actions by the compromised principal in the last 72 hours\n3. Identify which buckets and objects were accessed using Athena queries\n4. Cross-reference accessed objects with Macie classifications to assess data sensitivity\n5. Check for CopyObject calls to external accounts (cross-account exfiltration)\n6. Review how the credentials were compromised (TruffleHog scan, phishing investigation)\n7. Implement VPC endpoint policies to restrict future S3 access to approved network paths\n\n**Pitfalls**: CloudTrail S3 data events can generate massive log volume. Use Athena with partitioned tables rather than CloudWatch Logs Insights for queries spanning more than 24 hours. GuardDuty baseline learning requires 7-14 days, so new accounts may generate false positives for normal access patterns.\n\n## Output Format\n\n```\nS3 Data Exfiltration Investigation Report\n============================================\nAccount: 123456789012\nDetection Source: GuardDuty Exfiltration:S3\u002FObjectRead.Unusual\nInvestigation Date: 2026-02-23\n\nINCIDENT TIMELINE:\n  2026-02-23 02:47 UTC - First anomalous GetObject from 185.x.x.x\n  2026-02-23 02:47-04:12 UTC - 12,847 GetObject requests\n  2026-02-23 04:15 UTC - GuardDuty finding generated\n  2026-02-23 04:20 UTC - PagerDuty alert received by SOC\n  2026-02-23 04:25 UTC - Access key deactivated\n\nCOMPROMISED PRINCIPAL:\n  ARN: arn:aws:iam::123456789012:user\u002Fdeveloper-jane\n  Access Key: AKIA...WXYZ\n  Source IP: 185.x.x.x (Tor exit node)\n\nDATA IMPACT ASSESSMENT:\n  Buckets accessed: 3\n  Objects downloaded: 12,847\n  Total data volume: 4.7 GB\n  Sensitive data types: PII (SSN, email), Financial (credit card)\n  Macie severity: CRITICAL\n\nCONTAINMENT ACTIONS:\n  [x] Access key deactivated\n  [x] User password reset and MFA re-enrolled\n  [x] VPC endpoint policy applied to sensitive buckets\n  [x] Bucket policy restricting to VPC-only access\n  [x] TruffleHog scan initiated on developer repositories\n```\n","# Detecting S3 Data Exfiltration Attempts\n\n## When to Use\n\n- When GuardDuty detects anomalous S3 access patterns such as bulk downloads from unusual IPs\n- When investigating suspected data breach involving S3-stored sensitive data\n- When building detection rules for S3 data loss prevention monitoring\n- When responding to Macie alerts about sensitive data being accessed or moved\n- When compliance requires monitoring and logging of all access to classified data stores\n\n**Do not use** for preventing data exfiltration (use S3 bucket policies, VPC endpoints, and SCPs), for data classification (use Amazon Macie discovery jobs), or for network-level exfiltration detection (use VPC Flow Logs with network analysis tools).\n\n## Prerequisites\n\n- CloudTrail configured with S3 data event logging (`GetObject`, `PutObject`, `CopyObject`)\n- GuardDuty enabled with S3 Protection feature activated\n- Amazon Macie enabled for sensitive data discovery in target buckets\n- CloudWatch Logs or Athena for querying CloudTrail logs at scale\n- VPC endpoint policies configured for S3 access monitoring\n\n## Workflow\n\n### Step 1: Enable S3 Data Event Logging in CloudTrail\n\nConfigure CloudTrail to capture all S3 object-level operations for forensic analysis.\n\n```bash\n# Enable S3 data events on an existing trail\naws cloudtrail put-event-selectors \\\n  --trail-name management-trail \\\n  --event-selectors '[{\n    \"ReadWriteType\": \"All\",\n    \"IncludeManagementEvents\": true,\n    \"DataResources\": [{\n      \"Type\": \"AWS::S3::Object\",\n      \"Values\": [\"arn:aws:s3:::sensitive-data-bucket\u002F\", \"arn:aws:s3:::customer-records\u002F\"]\n    }]\n  }]'\n\n# Verify data event configuration\naws cloudtrail get-event-selectors --trail-name management-trail \\\n  --query 'EventSelectors[*].DataResources' --output json\n\n# Enable GuardDuty S3 Protection\naws guardduty update-detector \\\n  --detector-id $(aws guardduty list-detectors --query 'DetectorIds[0]' --output text) \\\n  --data-sources '{\"S3Logs\":{\"Enable\":true}}'\n```\n\n### Step 2: Query CloudTrail for Anomalous S3 Access Patterns\n\nAnalyze CloudTrail logs for bulk download activity, unusual access times, and unfamiliar source IPs.\n\n```bash\n# Athena query: Top S3 downloaders by volume in last 24 hours\ncat \u003C\u003C 'EOF'\nSELECT\n  useridentity.arn as principal,\n  sourceipaddress,\n  COUNT(*) as request_count,\n  SUM(CAST(json_extract_scalar(requestparameters, '$.bytesTransferredOut') AS bigint)) as bytes_downloaded\nFROM cloudtrail_logs\nWHERE eventname = 'GetObject'\n  AND eventsource = 's3.amazonaws.com'\n  AND eventtime > date_add('hour', -24, now())\nGROUP BY useridentity.arn, sourceipaddress\nORDER BY request_count DESC\nLIMIT 50\nEOF\n\n# CloudWatch Logs Insights: S3 GetObject requests from unusual IPs\naws logs start-query \\\n  --log-group-name cloudtrail-logs \\\n  --start-time $(date -d \"24 hours ago\" +%s) \\\n  --end-time $(date +%s) \\\n  --query-string '\n    fields @timestamp, userIdentity.arn, sourceIPAddress, requestParameters.bucketName, requestParameters.key\n    | filter eventName = \"GetObject\"\n    | stats count() as requestCount by sourceIPAddress, userIdentity.arn\n    | sort requestCount desc\n    | limit 25\n  '\n\n# Detect cross-account copies (potential exfiltration)\naws logs start-query \\\n  --log-group-name cloudtrail-logs \\\n  --start-time $(date -d \"7 days ago\" +%s) \\\n  --end-time $(date +%s) \\\n  --query-string '\n    fields @timestamp, userIdentity.arn, sourceIPAddress, requestParameters.bucketName\n    | filter eventName in [\"CopyObject\", \"ReplicateObject\", \"UploadPart\"]\n    | filter userIdentity.accountId != \"OUR_ACCOUNT_ID\"\n    | sort @timestamp desc\n    | limit 100\n  '\n```\n\n### Step 3: Review GuardDuty S3 Findings\n\nCheck for GuardDuty S3-specific finding types that indicate exfiltration activity.\n\n```bash\n# List active S3 exfiltration-related findings\naws guardduty list-findings \\\n  --detector-id $(aws guardduty list-detectors --query 'DetectorIds[0]' --output text) \\\n  --finding-criteria '{\n    \"Criterion\": {\n      \"type\": {\n        \"Eq\": [\n          \"Exfiltration:S3\u002FMaliciousIPCaller\",\n          \"Exfiltration:S3\u002FObjectRead.Unusual\",\n          \"Discovery:S3\u002FMaliciousIPCaller.Custom\",\n          \"Discovery:S3\u002FBucketEnumeration.Unusual\",\n          \"UnauthorizedAccess:S3\u002FMaliciousIPCaller.Custom\",\n          \"UnauthorizedAccess:S3\u002FTorIPCaller\",\n          \"Impact:S3\u002FAnomalousBehavior.Delete\"\n        ]\n      }\n    }\n  }' --output json\n\n# Get detailed finding information\naws guardduty get-findings \\\n  --detector-id $(aws guardduty list-detectors --query 'DetectorIds[0]' --output text) \\\n  --finding-ids FINDING_IDS \\\n  --query 'Findings[*].{Type:Type,Severity:Severity,Resource:Resource.S3BucketDetails[0].Name,Action:Service.Action}' \\\n  --output table\n```\n\n### Step 4: Analyze Macie Findings for Sensitive Data Access\n\nReview Macie findings to correlate data sensitivity with access anomalies.\n\n```bash\n# List Macie findings for sensitive data exposure\naws macie2 list-findings \\\n  --finding-criteria '{\n    \"criterion\": {\n      \"category\": {\"eq\": [\"CLASSIFICATION\"]},\n      \"severity.description\": {\"eq\": [\"High\", \"Critical\"]}\n    }\n  }' \\\n  --sort-criteria '{\"attributeName\": \"updatedAt\", \"orderBy\": \"DESC\"}' \\\n  --max-results 25\n\n# Get detailed finding with data classification\naws macie2 get-findings \\\n  --finding-ids FINDING_IDS \\\n  --query 'findings[*].{Type:type,Severity:severity.description,Bucket:resourcesAffected.s3Bucket.name,SensitiveDataTypes:classificationDetails.result.sensitiveData[*].category}' \\\n  --output table\n\n# Run a sensitive data discovery job on target bucket\naws macie2 create-classification-job \\\n  --job-type ONE_TIME \\\n  --name \"exfiltration-investigation\" \\\n  --s3-job-definition '{\n    \"bucketDefinitions\": [{\n      \"accountId\": \"ACCOUNT_ID\",\n      \"buckets\": [\"sensitive-data-bucket\"]\n    }]\n  }'\n```\n\n### Step 5: Build Automated Detection Rules\n\nCreate CloudWatch alarms and EventBridge rules for real-time exfiltration detection.\n\n```bash\n# CloudWatch metric filter for high-volume S3 downloads\naws logs put-metric-filter \\\n  --log-group-name cloudtrail-logs \\\n  --filter-name s3-bulk-download \\\n  --filter-pattern '{$.eventName = \"GetObject\" && $.eventSource = \"s3.amazonaws.com\"}' \\\n  --metric-transformations '[{\n    \"metricName\": \"S3GetObjectCount\",\n    \"metricNamespace\": \"SecurityMetrics\",\n    \"metricValue\": \"1\",\n    \"defaultValue\": 0\n  }]'\n\n# Alarm for anomalous download volume (>1000 objects\u002Fhour)\naws cloudwatch put-metric-alarm \\\n  --alarm-name s3-exfiltration-alert \\\n  --metric-name S3GetObjectCount \\\n  --namespace SecurityMetrics \\\n  --statistic Sum \\\n  --period 3600 \\\n  --threshold 1000 \\\n  --comparison-operator GreaterThanThreshold \\\n  --evaluation-periods 1 \\\n  --alarm-actions arn:aws:sns:us-east-1:ACCOUNT:security-alerts\n\n# EventBridge rule for GuardDuty S3 findings\naws events put-rule \\\n  --name guardduty-s3-exfiltration \\\n  --event-pattern '{\n    \"source\": [\"aws.guardduty\"],\n    \"detail-type\": [\"GuardDuty Finding\"],\n    \"detail\": {\n      \"type\": [{\"prefix\": \"Exfiltration:S3\u002F\"}]\n    }\n  }'\n```\n\n### Step 6: Implement Preventive Controls\n\nDeploy bucket policies and VPC endpoint policies to restrict data movement paths.\n\n```bash\n# VPC endpoint policy restricting S3 access to specific buckets\naws ec2 modify-vpc-endpoint \\\n  --vpc-endpoint-id vpce-ENDPOINT_ID \\\n  --policy-document '{\n    \"Statement\": [{\n      \"Sid\": \"RestrictToOwnBuckets\",\n      \"Effect\": \"Allow\",\n      \"Principal\": \"*\",\n      \"Action\": [\"s3:GetObject\", \"s3:PutObject\"],\n      \"Resource\": [\"arn:aws:s3:::approved-bucket-1\u002F*\", \"arn:aws:s3:::approved-bucket-2\u002F*\"]\n    }]\n  }'\n\n# Bucket policy denying access from outside the VPC\naws s3api put-bucket-policy --bucket sensitive-data-bucket --policy '{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [{\n    \"Sid\": \"DenyNonVpcAccess\",\n    \"Effect\": \"Deny\",\n    \"Principal\": \"*\",\n    \"Action\": \"s3:GetObject\",\n    \"Resource\": \"arn:aws:s3:::sensitive-data-bucket\u002F*\",\n    \"Condition\": {\n      \"StringNotEquals\": {\n        \"aws:sourceVpce\": \"vpce-ENDPOINT_ID\"\n      }\n    }\n  }]\n}'\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| S3 Data Events | CloudTrail object-level logging that captures GetObject, PutObject, DeleteObject, and CopyObject API calls with request details |\n| GuardDuty S3 Protection | Threat detection feature analyzing CloudTrail S3 data events to identify anomalous access patterns and exfiltration attempts |\n| Amazon Macie | Data security service that discovers and classifies sensitive data in S3 and generates findings for data exposure risks |\n| VPC Endpoint Policy | Access control policy on an S3 VPC endpoint that restricts which buckets and actions can be accessed through the endpoint |\n| Data Exfiltration | Unauthorized transfer of data from an organization's S3 storage to an external location controlled by an attacker |\n| Anomalous Behavior Detection | Machine learning-based identification of S3 access patterns that deviate from established baselines for a principal |\n\n## Tools & Systems\n\n- **AWS CloudTrail**: Audit logging of S3 object-level operations for forensic analysis and anomaly detection\n- **Amazon GuardDuty**: ML-based threat detection with S3-specific finding types for exfiltration and unauthorized access\n- **Amazon Macie**: Sensitive data discovery and classification for correlating access anomalies with data sensitivity\n- **Amazon Athena**: SQL query engine for analyzing CloudTrail logs at scale to identify bulk download patterns\n- **CloudWatch Logs Insights**: Real-time log analysis for building detection queries against CloudTrail data\n\n## Common Scenarios\n\n### Scenario: Compromised IAM Credentials Used for Bulk S3 Data Download\n\n**Context**: GuardDuty reports an `Exfiltration:S3\u002FObjectRead.Unusual` finding indicating that a developer's access key is downloading thousands of objects from a sensitive data bucket at 3 AM from an IP address in a foreign country.\n\n**Approach**:\n1. Immediately deactivate the compromised access key\n2. Query CloudTrail for all S3 actions by the compromised principal in the last 72 hours\n3. Identify which buckets and objects were accessed using Athena queries\n4. Cross-reference accessed objects with Macie classifications to assess data sensitivity\n5. Check for CopyObject calls to external accounts (cross-account exfiltration)\n6. Review how the credentials were compromised (TruffleHog scan, phishing investigation)\n7. Implement VPC endpoint policies to restrict future S3 access to approved network paths\n\n**Pitfalls**: CloudTrail S3 data events can generate massive log volume. Use Athena with partitioned tables rather than CloudWatch Logs Insights for queries spanning more than 24 hours. GuardDuty baseline learning requires 7-14 days, so new accounts may generate false positives for normal access patterns.\n\n## Output Format\n\n```\nS3 Data Exfiltration Investigation Report\n============================================\nAccount: 123456789012\nDetection Source: GuardDuty Exfiltration:S3\u002FObjectRead.Unusual\nInvestigation Date: 2026-02-23\n\nINCIDENT TIMELINE:\n  2026-02-23 02:47 UTC - First anomalous GetObject from 185.x.x.x\n  2026-02-23 02:47-04:12 UTC - 12,847 GetObject requests\n  2026-02-23 04:15 UTC - GuardDuty finding generated\n  2026-02-23 04:20 UTC - PagerDuty alert received by SOC\n  2026-02-23 04:25 UTC - Access key deactivated\n\nCOMPROMISED PRINCIPAL:\n  ARN: arn:aws:iam::123456789012:user\u002Fdeveloper-jane\n  Access Key: AKIA...WXYZ\n  Source IP: 185.x.x.x (Tor exit node)\n\nDATA IMPACT ASSESSMENT:\n  Buckets accessed: 3\n  Objects downloaded: 12,847\n  Total data volume: 4.7 GB\n  Sensitive data types: PII (SSN, email), Financial (credit card)\n  Macie severity: CRITICAL\n\nCONTAINMENT ACTIONS:\n  [x] Access key deactivated\n  [x] User password reset and MFA re-enrolled\n  [x] VPC endpoint policy applied to sensitive buckets\n  [x] Bucket policy restricting to VPC-only access\n  [x] TruffleHog scan initiated on developer repositories\n```\n",{"name":5,"tags":44,"capec":49,"model":50,"tools":51,"domain":38,"maxTurns":55,"nist_csf":56,"subdomain":45,"description":7,"mitre_attack":61},[45,46,47,34,48,33,35],"cloud-security","aws","s3","guardduty",[],"sonnet",[52,31,53,54],"Read","Glob","Grep",20,[57,58,59,60],"PR.IR-01","ID.AM-08","GV.SC-06","DE.CM-01",[62,63,64,65],"T1041","T1059","T1530","T1562.001","main","a91f1293287ffa9f4f1b8f486cd6e835a1568c84","skills\u002Fcloud\u002Fsecurity\u002Fdata\u002Fprotect\u002Fdetect","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace","https:\u002F\u002Fgithub.com\u002FDCx7C5","#Python","2026-09-01 11:21:00",{"source":8,"skillName":5,"commands":74,"prompt":84,"zipAvailable":85},[75,78,81],{"tool":76,"command":77},"npx","npx skills add DCx7C5\u002Fai-marketplace --skill security-data-protect-detect",{"tool":79,"command":80},"bunx","bunx skills add DCx7C5\u002Fai-marketplace --skill security-data-protect-detect",{"tool":82,"command":83},"pnpm","pnpm dlx skills add DCx7C5\u002Fai-marketplace --skill security-data-protect-detect","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fsecurity\u002Fdata\u002Fprotect\u002Fdetect\u002FSKILL.md",true,[87],{"path":88,"resourceType":89,"resourceTypeDesc":90,"sizeBytes":91,"sourceHtmlUrl":92},"index.json","REFERENCE","参考文档",695,"https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fsecurity\u002Fdata\u002Fprotect\u002Fdetect\u002Findex.json",[94,104,127,149,170,192],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":98,"licenseFileUrl":99,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":103},"01M73MDK3NT5XHNYTQ5P5172V9","devel-jb-algorithmic-art","- Embed algorithms inline in the HTML artifact (don't create separate .","Apache-2.0","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fdevel-jb-algorithmic-art\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fdevel-jb-algorithmic-art\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":39},"01M71HAPZ01KQ30RKTB0FFSQ05","services-wmi-persistence-detect","Detect WMI event subscription persistence by enumerating ActiveScriptEventConsumer, CommandLineEventConsumer, and permanent subscriptions in the WMI repository.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fservices\u002Fwmi\u002Fpersistence\u002Fdetect\u002FSKILL.md",[],[111,20,112,113,114,115,116,38,117,118,119,120,121,122,123,124,125,30,126],"services","services wmi persistence detect","wmi","persistence","process-forensics","process","forensics","t1546.003","event-subscription","subscription","repository","commandline-consumer","subscriptions","event","activescript","de",{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":39},"01M71HAK6JTTTS229T17WJMMCG","services-wmi-exec-exploit","Perform lateral movement across Windows networks using WMI-based remote execution techniques including Impacket wmiexec.py, CrackMapExec, and native WMI commands for stealthy post-exploitation during red team engagements.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fservices\u002Fwmi\u002Fexec\u002Fexploit\u002FSKILL.md",[],[134,113,135,111,136,137,31,138,139,38,140,141,142,143,144,145,146,147,126,148],"exec","services wmi exec exploit","exploit","across","analysis","team","traffic","remote","crackmapexec","Impacket","lateral-movement","read","lateral movement","command","native",{"skillNo":150,"name":151,"nameZh":6,"description":152,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":153,"categories":154,"keywords":155,"publishedAt":39},"01M71HAG6MHKNQV8KDZKMT4886","registry-artifact-extract","Extract and analyze Windows Registry hives to uncover user activity, installed software, autostart entries, and evidence of system compromise.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fregistry\u002Fartifact\u002Fextract\u002FSKILL.md",[],[156,157,158,159,160,50,161,162,163,164,145,126,165,166,138,167,31,38,168,169],"extract","registry artifact extract","registry","artifact","digital-forensics","regripper","windows-registry","evidence-collection","software","uncover","analyze","collection","artifact-analysis","activity",{"skillNo":171,"name":172,"nameZh":6,"description":173,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":174,"categories":175,"keywords":176,"publishedAt":39},"01M71HACR4A8XTWTTSXK4124AA","processes-token-impersonate-detect","Detect Windows token impersonation and privilege abuse including SeImpersonatePrivilege exploitation via Potato attacks and token stealing techniques.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Ftoken\u002Fimpersonate\u002Fdetect\u002FSKILL.md",[],[177,178,179,20,38,180,30,181,182,183,115,126,184,185,186,187,188,189,190,191],"processes","token","processes token impersonate detect","techniques","escalation","windows","attacks","via","impersonation","potato","exploitation","printspoofer","token-impersonation","seimpersonate","privilege-escalation",{"skillNo":193,"name":194,"nameZh":6,"description":195,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":196,"categories":197,"keywords":198,"publishedAt":39},"01M71HAABSB4Z6QFSXEG00R4RK","processes-thread-injection-detect","Detect Windows thread injection techniques including CreateRemoteThread, QueueUserAPC, NtCreateThreadEx, and thread hijacking via process memory analysis.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Fthread\u002Finjection\u002Fdetect\u002FSKILL.md",[],[199,177,200,20,201,202,116,126,184,203,204,205,138,115,38,180,206,30,207,182],"thread","injection","processes thread injection detect","thread-injection","nt-api","apc-injection","api","process-injection","memory"]