--- name: orca-investigate description: CDR-powered incident investigation — traces actor activity, builds session timelines, maps MITRE ATT&CK techniques, and assesses blast radius from cloud audit logs. Use when user asks to investigate activity, trace an actor, or analyze an incident (e.g., "investigate bastion-admin", "trace activity", "what did anika do", "incident investigation"). --- # Orca Investigate Skill Answers the question: **"What happened, who did it, and how far did they get?"** Given an actor (IAM identity), source IP, target resource, or suspicious event, traces activity through Orca CDR (CloudTrail/audit logs), builds a session timeline, maps actions to MITRE ATT&CK techniques, clusters related sessions, and assesses the blast radius. ## Usage ``` /orca-investigate arn:aws:iam::123456789012:role/bastion-admin-role /orca-investigate 10.0.1.50 /orca-investigate account 123456789012 ``` Or natural language: - "investigate what this role did in the last 24 hours" - "trace activity from IP 10.0.1.50" - "what happened in this account today?" - "investigate suspicious AssumeRole events" - "who accessed the prod database?" - "incident investigation for orca-3636513" ## Processing Logic ### Step 1: Determine Investigation Scope Parse user input to determine the investigation axis: | Input Pattern | Primary Filter | CDR Parameter | |--------------|---------------|---------------| | ARN (actor) | Identity-based | `actors: [""]` | | IP address | Source-based | `source_ip_addresses: [""]` | | Resource ARN/name | Target-based | `targets: [""]` | | Account ID | Account-wide | `accounts: [""]` | | Event/action name | Action-based | `actions: [""]` | | Alert ID (orca-XXXX) | Alert-initiated | Fetch alert, extract actor/target, then CDR | | Service name | Service-based | `services: [""]` | Determine time range: - Default: `"last_24_hours"` for active incidents - "last 3 days" / "last week" → `"last_3_days"` / `"last_7_days"` - User-specified → map to nearest CDR enum ### Step 2: Gather Data (run ALL in parallel) **Query 1: Events by the actor/from the source/on the target** ``` search_cdr_events: : [] time_range: "" limit: 100 ``` **Query 2: Event summary grouped by action** ``` get_cdr_events_grouped_by_event_name: : [] time_range: "" page_size: 100 ``` **Query 3: If actor-based, also search as target** ``` search_cdr_events: targets: [""] time_range: "" limit: 50 ``` (To find events done TO this identity — policy changes, permission grants, etc.) **Query 4: If alert-initiated, fetch the alert** ``` get_alert: alert_id: "" ``` **Query 5: Related alerts on the asset** ``` get_asset_related_alerts_summary: asset_id: ``` **Query 6: Related attack paths** ``` get_asset_related_attack_paths_summary: asset_id: ``` ### Step 3: Build Session Timeline From CDR events, construct a chronological timeline: 1. **Sort all events by timestamp** 2. **Cluster into sessions** based on: - Same actor + same source IP + events within 30-minute gaps = one session - Actor change or long gap = new session 3. **For each session:** - Start time, end time, duration - Source IP(s) and user-agent(s) - Actions performed (in order) - Resources touched - Success/failure status of each action ### Step 4: MITRE ATT&CK Mapping Map observed actions to MITRE ATT&CK for Cloud: ``` CDR Action MITRE Technique Tactic ────────────────────────────────────────────────────────────────────────────────── ConsoleLogin T1078 — Valid Accounts Initial Access AssumeRole (cross-account) T1550.001 — Web Session Cookie Lateral Movement AssumeRole (same account) T1078.004 — Cloud Accounts Privilege Escalation CreateUser / CreateAccessKey T1136.003 — Cloud Account Persistence AttachUserPolicy / PutRolePolicy T1098.003 — Additional Cloud Roles Persistence PutBucketPolicy (public) T1537 — Transfer to Cloud Account Exfiltration GetObject (bulk S3) T1530 — Data from Cloud Storage Collection DescribeInstances / ListBuckets T1580 — Cloud Infrastructure Discovery RunInstances T1578.002 — Create Cloud Instance Resource Hijacking StopLogging / DeleteTrail T1562.008 — Disable Cloud Logs Defense Evasion ModifyInstanceAttribute T1578 — Modify Cloud Compute Execution AuthorizeSecurityGroupIngress T1562.007 — Disable Cloud Firewall Defense Evasion DeleteSnapshot / DeleteBucket T1485 — Data Destruction Impact GetSecretValue / GetParameter T1552.004 — Cloud Secrets Credential Access Invoke / InvokeFunction T1648 — Serverless Execution Execution PutObject (to external account) T1537 — Transfer to Cloud Account Exfiltration CreateSnapshot (shared externally) T1537 — Transfer to Cloud Account Exfiltration ``` For each mapped technique, assess: - **Confidence**: HIGH (action directly matches) / MEDIUM (action could be benign) / LOW (speculative) - **Context**: Was it expected for this identity's role? ### Step 5: Assess Blast Radius Determine the scope of impact: 1. **Resources touched** — how many distinct resources were accessed/modified? 2. **Services involved** — how many AWS/Azure/GCP services? 3. **Accounts reached** — any cross-account activity? 4. **Data access** — any data stores accessed (S3, RDS, Secrets Manager)? 5. **Persistence indicators** — any new users, keys, roles, or policies created? 6. **Defense evasion** — any logging/monitoring changes? 7. **Lateral movement** — any role assumptions or cross-account jumps? Classify blast radius: ``` CONTAINED — activity limited to 1-2 resources in 1 service MODERATE — multiple resources or services, same account BROAD — multiple accounts or significant data access SEVERE — persistence established + data accessed + evasion attempted ``` ### Step 6: Generate Verdict ``` IF defense_evasion AND persistence AND data_access THEN "ACTIVE COMPROMISE — containment needed NOW" ELSE IF persistence OR cross_account_lateral_movement THEN "PROBABLE COMPROMISE — investigate and contain" ELSE IF unusual_actions AND (off_hours OR new_source_ip) THEN "SUSPICIOUS — requires investigation" ELSE IF actions_match_role AND normal_hours AND known_ips THEN "LIKELY BENIGN — routine activity" ELSE "INCONCLUSIVE — need more data" ``` ## Proactive Remediation Behavior **CRITICAL: Never leave the user with just data. After EVERY output layer, suggest the next action and offer to generate containment/remediation code.** After the dashboard and after every drill-down section: 1. **Suggest what to do next** — based on the verdict, recommend containment or remediation 2. **Offer remediation format selection** — always ask: "I can generate containment scripts. What format do you prefer?" 3. **Supported formats**: Terraform, CloudFormation, Ansible, CLI commands (aws/az/gcloud), step-by-step instructions, Pulumi, ARM/Bicep 4. **Urgency-based suggestions**: - ACTIVE COMPROMISE → "I can generate containment scripts NOW — revoke access, isolate resources" - PROBABLE COMPROMISE → "I can generate investigation runbooks and containment scripts" - SUSPICIOUS → "I can generate detection rules and monitoring configs" - LIKELY BENIGN → "I can generate an allowlist rule or close the alert" When the user selects a format: - Generate the containment/remediation code immediately (IAM policy revocation, security group isolation, credential rotation, detection rules) - Write it to a file: `contain-.` (e.g., `.tf`, `.yml`, `.sh`) - Include verification commands and rollback instructions - Suggest the next investigation step after containment **Format mapping:** | User says | Extension | Template | |-----------|-----------|----------| | Terraform | `.tf` | HCL with IAM deny policy / SG isolation resources | | CloudFormation | `.cfn.yaml` | YAML template with containment resources | | Ansible | `.yml` | Playbook with containment tasks | | CLI | `.sh` | Shell script with immediate containment commands | | Instructions | inline | Step-by-step containment runbook | | Pulumi | `.ts` | TypeScript Pulumi containment program | | ARM/Bicep | `.bicep` | Bicep template for Azure containment | ## Output Format ### Layer 1: Dashboard ``` ═══════════════════════════════════════════════════════════════════ INVESTIGATION — |