agent security skill risk: medium
AWS CloudTrail Anomaly Detection Guide
The prompt outlines steps for querying CloudTrail events via boto3, building statistical baselines of API activity, detecting anomalies such as unusual event sources or first-time…
- External action: medium
SKILL 4 files · 2 folders
SKILL.md
--- name: detecting-aws-cloudtrail-anomalies description: "Detect unusual API call patterns in AWS CloudTrail logs using boto3, statistical baselining, and behavioral analysis" --- # Detecting AWS CloudTrail Anomalies ## Overview AWS CloudTrail records API calls across AWS services. This skill covers querying CloudTrail events with boto3's `lookup_events` API, building statistical baselines of normal API activity, detecting anomalies such as unusual event sources, geographic anomalies, high-frequency API calls, and first-time API usage patterns that indicate compromised credentials or insider threats. ## When to Use - When investigating security incidents that require detecting aws cloudtrail anomalies - When building detection rules or threat hunting queries for this domain - When SOC analysts need structured procedures for this analysis type - When validating security monitoring coverage for related attack techniques ## Prerequisites - Python 3.9+ with `boto3` library - AWS credentials with CloudTrail read permissions (cloudtrail:LookupEvents) - Understanding of AWS IAM and common API patterns - CloudTrail enabled in target AWS account (management events at minimum) ## Steps ### Step 1: Query CloudTrail Events Use boto3 CloudTrail client's lookup_events to retrieve recent API activity with pagination. ### Step 2: Build Activity Baseline Aggregate events by user, source IP, event source, and event name to establish normal behavior patterns. ### Step 3: Detect Anomalies Flag unusual patterns: new event sources per user, first-time API calls, geographic IP changes, high error rates, and sensitive API usage (IAM, KMS, S3 policy changes). ### Step 4: Generate Detection Report Produce a JSON report with anomaly scores, top suspicious users, and recommended investigation actions. ## Expected Output JSON report with event statistics, baseline deviations, anomalous users/IPs, sensitive API calls, and error rate analysis.
REQUIRED CONTEXT
- AWS CloudTrail events data
OPTIONAL CONTEXT
- Python environment with boto3
- AWS credentials
TOOLS REQUIRED
- code_execution
EXPECTED OUTPUT
- Format
- json
- Schema
- json_schema · event statistics, baseline deviations, anomalous users/IPs, sensitive API calls, error rate analysis
- Constraints
- include event statistics
- include baseline deviations
- include anomalous users/IPs
- include sensitive API calls
- include error rate analysis
CAVEATS
- Dependencies
- Python 3.9+ with `boto3` library
- AWS credentials with CloudTrail read permissions (cloudtrail:LookupEvents)
- Understanding of AWS IAM and common API patterns
- CloudTrail enabled in target AWS account (management events at minimum)
- Missing context
- Anomaly detection thresholds or algorithms
- Exact JSON schema or example report structure
- Sample input data or test cases
QUALITY
- OVERALL
- 0.67
- CLARITY
- 0.82
- SPECIFICITY
- 0.58
- REUSABILITY
- 0.68
- COMPLETENESS
- 0.65
IMPROVEMENT SUGGESTIONS
- Expand each step with concrete code snippets or pseudocode using boto3 and statistical libraries
- Add explicit success criteria or validation checks for the generated report
USAGE
Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.
MORE FOR AGENT
- MoltPass Client for AI Agent Identitiesagentsecurity
- Supply Chain Dependency Risk Auditoragentsecurity
- Supply Chain Dependency Risk Auditoragentsecurity
- Threat Modeling Security Expertagentsecurity
- Security Bluebook Policy Builderagentsecurity
- Security Bluebook Policy Builderagentsecurity
- Security Blue Book Policy Builderagentsecurity
- Threat Modeling Security Architecture Expertagentsecurity
- Supply Chain Dependency Risk Auditoragentsecurity
- Threat Modeling Security Expertagentsecurity
- SIEM Detection Rule Tuning Guideagentsecurity
- AI File Metadata Compliance Auditoragentsecurity
- Azure Storage Misconfiguration Audit Reporteragentsecurity
- Implementing PAM for Database Accessagentsecurity
- AFL++ Coverage-Guided Fuzzing Procedureagentsecurity
- Supply Chain Attack Simulation Detectoragentsecurity
- Security Audit Fix Verifieragentsecurity
- Active Directory ACL Abuse Analyzeragentsecurity
- Privileged Access Workstation Implementation Guideagentsecurity
- SSRF Vulnerability Testing and Reporting Guideagentsecurity
- Security Audit Fix Revieweragentsecurity
- AWS IAM Privilege Escalation Detectoragentsecurity
- SSL/TLS Security Assessment with Sslyzeagentsecurity
- GCP Penetration Testing with GCPBucketBruteagentsecurity
- Security Audit Fix Commit Revieweragentsecurity