Performing Cloud Log Forensics With Athena
Overview
Cybersecurity skill for performing cloud log forensics with athena. Follows industry best practices and security standards.
When to Use
Trigger phrases:
"performing cloud log forensics with athena"
"When investigating AWS security incidents that require querying massive volumes"
"When performing forensic analysis across CloudTrail, VPC Flow Logs, S3 access lo"
"When building reusable Athena tables with partition projection for ongoing incid"
When investigating AWS security incidents that require querying massive volumes of cloud logs
When performing forensic analysis across CloudTrail, VPC Flow Logs, S3 access logs, and ALB logs
When building reusable Athena tables with partition projection for ongoing incident response
When hunting for indicators of compromise across multiple AWS log sources simultaneously
When creating evidence-grade SQL queries for compliance audits or legal proceedings
When NOT to Use
- When you lack proper authorization for testing
- For production systems without change management
- When the task requires legal or compliance expertise beyond technical scope
Prerequisites
- AWS account with Athena, S3, and Glue permissions
- CloudTrail configured to deliver logs to an S3 bucket
- VPC Flow Logs enabled and publishing to S3
- S3 server access logging enabled on target buckets
- ALB access logging enabled and publishing to S3
- Python 3.8+ with boto3 installed
- Appropriate IAM permissions for Athena queries and S3 access
Workflow
# Example: IOC detection
import re
IOC_PATTERNS = {
"ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",
"domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",
"hash_md5": r"\b[a-f0-9]{32}\b",
"hash_sha256": r"\b[a-f0-9]{64}\b",
}
def extract_iocs(text: str) -> dict:
return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}
- Plan Operations — Define objectives, scope, and success criteria for cloud log forensics operations.
- Prepare Environment — Set up tools, access, and data sources required for cloud log forensics.
- Execute Core Workflow — Use athena to perform cloud log forensics operations following established procedures.
- Validate Results — Verify that results meet quality standards and objectives.
- Report Findings — Document results, observations, and recommendations.
- Follow Up — Track remediation actions and verify fixes where applicable.
Tools
- athena — Primary tool for this skill
- Analysis Platform — Data processing and visualization
- Collaboration Tools — Team coordination and knowledge sharing
Process
- Reconnaissance — Gather target information, identify attack surface, enumerate services
- Analysis/Exploitation — Execute the technique, analyze results, document findings
- Reporting — Document IOCs, write findings, provide remediation recommendations
Verification
Anti-Rationalization Table
| Rationalization |
Reality |
| "We are too small to be targeted" |
Automated attacks target everyone. Size does not matter. |
| "Security slows us down" |
A breach slows you down 100x more. Build security in from the start. |
| "We will fix it after launch" |
Vulnerabilities in production are exploited within hours. Fix before deploy. |
1---2name: performing-cloud-log-forensics-with-athena3description: 'Use when uses AWS Athena to query CloudTrail, VPC Flow Logs, S3 access4 logs, and ALB logs for forensic investigation. Covers CREATE TABLE DDL with partition5 projection, forensic SQL queries for detecting unauthorized access, data exfiltration,6 lateral movement, and privilege escalation. Use when investigating AWS security7 incidents or building cloud-native forensic workflows at scale.89 '10domain: cybersecurity11tags:12- cloud13- forensics14- athena15- aws16- cloudtrail17- vpc-flow-logs18- s319- alb20subdomain: cloud-security21version: '1.0'22author: oyi7723license: Apache-2.024nist_csf:25- PR.IR-0126- ID.AM-0827- GV.SC-0628- DE.CM-0129category: cybersecurity30metadata:31 source: https://skillmd.com/skills/oyi77/performing-cloud-log-forensics-with-athena32---3334# Performing Cloud Log Forensics With Athena3536## Overview3738Cybersecurity skill for performing cloud log forensics with athena. Follows industry best practices and security standards.3940## When to Use4142**Trigger phrases:**43- "performing cloud log forensics with athena"44- "When investigating AWS security incidents that require querying massive volumes"45- "When performing forensic analysis across CloudTrail, VPC Flow Logs, S3 access lo"46- "When building reusable Athena tables with partition projection for ongoing incid"474849- When investigating AWS security incidents that require querying massive volumes of cloud logs50- When performing forensic analysis across CloudTrail, VPC Flow Logs, S3 access logs, and ALB logs51- When building reusable Athena tables with partition projection for ongoing incident response52- When hunting for indicators of compromise across multiple AWS log sources simultaneously53- When creating evidence-grade SQL queries for compliance audits or legal proceedings545556## When NOT to Use5758- When you lack proper authorization for testing59- For production systems without change management60- When the task requires legal or compliance expertise beyond technical scope616263## Prerequisites6465- AWS account with Athena, S3, and Glue permissions66- CloudTrail configured to deliver logs to an S3 bucket67- VPC Flow Logs enabled and publishing to S368- S3 server access logging enabled on target buckets69- ALB access logging enabled and publishing to S370- Python 3.8+ with boto3 installed71- Appropriate IAM permissions for Athena queries and S3 access7273## Workflow7475```python76# Example: IOC detection77import re7879IOC_PATTERNS = {80 "ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",81 "domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",82 "hash_md5": r"\b[a-f0-9]{32}\b",83 "hash_sha256": r"\b[a-f0-9]{64}\b",84}8586def extract_iocs(text: str) -> dict:87 return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}88```89901. **Plan Operations** — Define objectives, scope, and success criteria for cloud log forensics operations.912. **Prepare Environment** — Set up tools, access, and data sources required for cloud log forensics.923. **Execute Core Workflow** — Use athena to perform cloud log forensics operations following established procedures.934. **Validate Results** — Verify that results meet quality standards and objectives.945. **Report Findings** — Document results, observations, and recommendations.956. **Follow Up** — Track remediation actions and verify fixes where applicable.9697## Tools9899- **athena** — Primary tool for this skill100- **Analysis Platform** — Data processing and visualization101- **Collaboration Tools** — Team coordination and knowledge sharing102103104## Process1051061. **Reconnaissance** — Gather target information, identify attack surface, enumerate services1071. **Analysis/Exploitation** — Execute the technique, analyze results, document findings1081. **Reporting** — Document IOCs, write findings, provide remediation recommendations109110## Verification111112- [ ] All cloud log forensics procedures executed completely and documented113- [ ] Findings validated against multiple data sources114- [ ] False positives identified and filtered115- [ ] Results documented with evidence and timestamps116- [ ] Recommendations provided with risk-based prioritization117118## Anti-Rationalization Table119120| Rationalization | Reality |121|---|---|122| "We are too small to be targeted" | Automated attacks target everyone. Size does not matter. |123| "Security slows us down" | A breach slows you down 100x more. Build security in from the start. |124| "We will fix it after launch" | Vulnerabilities in production are exploited within hours. Fix before deploy. |