[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78MH7AX1W4ZXC7065NK98TB":3,"skill-same:01M78MH7AX1W4ZXC7065NK98TB":76},{"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":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M78MH7AX1W4ZXC7065NK98TB","detecting-s3-data-exfiltration-attempts",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.","jukeyman\u002Fjukeyman-skills","jukeyman","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142960420?v=4","01M78FR4Y3DHMMCBCC0GXXNB3F","RICK JEFFERSON","01M78FR4Z8RVQRAD31Y5J7V6EB",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdetecting-s3-data-exfiltration-attempts\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdetecting-s3-data-exfiltration-attempts\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: detecting-s3-data-exfiltration-attempts\ndescription: >\n  Detecting data exfiltration attempts from AWS S3 buckets by analyzing CloudTrail S3\n  data events, VPC Flow Logs, GuardDuty findings, Amazon Macie alerts, and S3 access\n  patterns to identify unauthorized bulk downloads and cross-account data transfers.\ndomain: cybersecurity\nsubdomain: cloud-security\ntags: [cloud-security, aws, s3, data-exfiltration, guardduty, macie, threat-detection]\nversion: \"1.0\"\nauthor: mahipal\nlicense: Apache-2.0\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":25,"author":33,"domain":34,"license":15,"version":35,"subdomain":26,"description":36},[26,27,28,29,30,31,32],"cloud-security","aws","s3","data-exfiltration","guardduty","macie","threat-detection","mahipal","cybersecurity","1.0","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.\n","main","99825ad3f3bcc6597ddcc7294a14e6e922f2b67b","skills\u002Fdetecting-s3-data-exfiltration-attempts",0,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills","https:\u002F\u002Fgithub.com\u002Fjukeyman","https:\u002F\u002FRJBUSINESSSOLUTIONS.ORG","Credit and Finance Expert | Developer\r\n\r\nI'm Rick Jefferson, a seasoned credit and finance expert with over a decade of experience in financial literacy,","2026-07-13 07:03:29",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add jukeyman\u002Fjukeyman-skills --skill detecting-s3-data-exfiltration-attempts",{"tool":52,"command":53},"bunx","bunx skills add jukeyman\u002Fjukeyman-skills --skill detecting-s3-data-exfiltration-attempts",{"tool":55,"command":56},"pnpm","pnpm dlx skills add jukeyman\u002Fjukeyman-skills --skill detecting-s3-data-exfiltration-attempts","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdetecting-s3-data-exfiltration-attempts\u002FSKILL.md",true,[60,64,70],{"path":61,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":63,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},"references\u002Fapi-reference.md","REFERENCE","参考文档",2540,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdetecting-s3-data-exfiltration-attempts\u002Freferences\u002Fapi-reference.md",{"path":71,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":75},"scripts\u002Fagent.py","SCRIPT","脚本",8238,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdetecting-s3-data-exfiltration-attempts\u002Fscripts\u002Fagent.py",[77,85,92,99,106,114],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":20},"01M79ANS2SM329NEP5ZCX106RR","zustand-store-creator","Create zustand store creator operations. Auto-activating skill for Frontend Development.\nTriggers on: zustand store creator, zustand store creator\nPart of the Frontend Development skill category. Use when working with zustand store creator functionality. Trigger with phrases like \"zustand store creator\", \"zustand creator\", \"zustand\".","MIT","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzustand-store-creator\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":20},"01M79AMZKP4YDEZ7EHG1Y7PP74","zero-trust-config-helper","Configure with zero trust config helper operations. Auto-activating skill for Security Advanced.\nTriggers on: zero trust config helper, zero trust config helper\nPart of the Security Advanced skill category. Use when configuring systems or services. Trigger with phrases like \"zero trust config helper\", \"zero helper\", \"zero\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzero-trust-config-helper\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":20},"01M79AMJSBCEJQNBTYNAHYN5HM","zapier-integration-helper","Assist with zapier integration helper operations. Auto-activating skill for Business Automation.\nTriggers on: zapier integration helper, zapier integration helper\nPart of the Business Automation skill category. Use when working with APIs or building integrations. Trigger with phrases like \"zapier integration helper\", \"zapier helper\", \"zapier\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzapier-integration-helper\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":20},"01M79AHJZGVMARS13VFQYRR1MP","yaml-config-validator","Validate yaml config validator operations. Auto-activating skill for DevOps Basics.\nTriggers on: yaml config validator, yaml config validator\nPart of the DevOps Basics skill category. Use when configuring systems or services. Trigger with phrases like \"yaml config validator\", \"yaml validator\", \"yaml\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fyaml-config-validator\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":110,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":20},"01M79AHGDZRN0020RDQSQDPAM8","xvary-stock-research","Thesis-driven equity analysis from public SEC EDGAR and market data; \u002Fanalyze, \u002Fscore, \u002Fcompare workflows with bundled Python tools (Claude Code, Cursor, Codex).","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FSKILL.md",[],[],{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":20},"01M79AHCYJ9FV9RMHQ24HDRN33","xss-vulnerability-scanner","Scan xss vulnerability scanner operations. Auto-activating skill for Security Fundamentals.\nTriggers on: xss vulnerability scanner, xss vulnerability scanner\nPart of the Security Fundamentals skill category. Use when working with xss vulnerability scanner functionality. Trigger with phrases like \"xss vulnerability scanner\", \"xss scanner\", \"xss\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxss-vulnerability-scanner\u002FSKILL.md",[],[]]