Security Investigation
Comprehensive security investigation and threat detection for Snowflake environments.
Overview
This skill provides a unified entry point for security investigations, routing to specialized sub-skills based on the detection type needed.
Sub-Skills
| Sub-Skill |
Purpose |
Load When |
login-ip-anomaly/SKILL.md |
Login anomalies, IP analysis, brute force, impossible travel |
Authentication issues, suspicious logins |
exfiltration-detection/SKILL.md |
Data exports, sharing, external transfers, app integrations |
Data theft investigation, bulk export alerts |
privilege-escalation/SKILL.md |
Role grants, user changes, RBAC violations, self-grants |
Unauthorized access, privilege abuse |
Threat Coverage
| Threat Category |
Sub-Skill |
Key Detections |
| Credential Attacks |
login-ip-anomaly |
Brute force, credential stuffing, impossible travel |
| Account Takeover |
login-ip-anomaly |
New IPs, rapid IP changes, failed logins |
| Data Theft |
exfiltration-detection |
UNLOAD, COPY, GET, presigned URLs, large downloads |
| Unauthorized Sharing |
exfiltration-detection |
CREATE SHARE, listings, external accounts |
| Supply Chain Risk |
exfiltration-detection |
OAuth apps, native apps, external functions |
| Privilege Abuse |
privilege-escalation |
ACCOUNTADMIN grants, self-grants, ownership transfers |
| Insider Threat |
privilege-escalation |
New users, backdoor accounts, service accounts |
| Persistence |
privilege-escalation |
Role creation, user creation, ADMIN OPTION grants |
MITRE ATT&CK Mapping
| Tactic |
Technique |
Sub-Skill |
Detection |
| Initial Access |
Valid Accounts (T1078) |
login-ip-anomaly |
New IP, failed logins |
| Persistence |
Create Account (T1136) |
privilege-escalation |
CREATE USER |
| Persistence |
Account Manipulation (T1098) |
privilege-escalation |
ALTER USER, role grants |
| Privilege Escalation |
Valid Accounts (T1078.004) |
privilege-escalation |
ACCOUNTADMIN grants |
| Defense Evasion |
Indicator Removal (T1070) |
privilege-escalation |
DROP USER/ROLE |
| Collection |
Data from Cloud Storage (T1530) |
exfiltration-detection |
Stage access, GET commands |
| Exfiltration |
Transfer to Cloud Account (T1537) |
exfiltration-detection |
COPY to S3/Azure/GCS |
| Exfiltration |
Exfiltration Over Web Service (T1567) |
exfiltration-detection |
External functions, APIs |
Workflow
Step 1: Determine Investigation Type
Ask user:
What type of security investigation do you need?
1. Login & Authentication Anomalies (suspicious logins, brute force, impossible travel)
2. Data Exfiltration Detection (bulk exports, sharing, external transfers)
3. Privilege Escalation (role grants, user changes, RBAC violations)
4. Full Security Scan (run all detections)
⚠️ STOP: Wait for user response.
Step 2: Load Appropriate Sub-Skill
Based on user selection:
| Selection |
Action |
| Login & Authentication |
Load login-ip-anomaly/SKILL.md |
| Data Exfiltration |
Load exfiltration-detection/SKILL.md |
| Privilege Escalation |
Load privilege-escalation/SKILL.md |
| Full Security Scan |
Run all three sub-skills sequentially |
Step 3: Execute Sub-Skill Workflow
Follow the loaded sub-skill's workflow:
- Select timeframe
- Run detection queries
- Analyze results
- Present findings
- Recommend actions
Full Security Scan
When running a full scan, execute in this order:
Phase 1: Privilege Escalation
Load privilege-escalation/SKILL.md and run:
- User/role creation detection
- Privileged role grants (ACCOUNTADMIN, SECURITYADMIN, etc.)
- Self-grants detection
- Current state audit
Phase 2: Login Anomalies
Load login-ip-anomaly/SKILL.md and run:
- IP baseline analysis
- New IP detection
- Rapid IP change detection
- Brute force detection
- Failed login analysis
Phase 3: Data Exfiltration
Load exfiltration-detection/SKILL.md and run:
- UNLOAD/COPY operations
- Stage and GET commands
- Data sharing activity
- Application/integration changes
- External table analysis
Quick Assessment Queries
For a rapid security check without loading sub-skills:
Critical Security Indicators
-- 1. ACCOUNTADMIN grants in last 7 days
SELECT user_name, LEFT(query_text, 200), start_time
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE LOWER(query_text) LIKE '%grant%accountadmin%'
AND query_type = 'GRANT'
AND start_time >= DATEADD('day', -7, CURRENT_TIMESTAMP())
ORDER BY start_time DESC;
-- 2. Failed logins from brute force IPs
SELECT client_ip, COUNT(*) as failures
FROM SNOWFLAKE.ACCOUNT_USAGE.LOGIN_HISTORY
WHERE is_success = 'NO'
AND event_timestamp >= DATEADD('day', -7, CURRENT_TIMESTAMP())
GROUP BY client_ip
HAVING COUNT(*) >= 5
ORDER BY failures DESC;
-- 3. Large data exports
SELECT user_name, query_type, bytes_scanned, rows_produced, start_time
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE query_type IN ('UNLOAD', 'COPY')
AND bytes_scanned > 1000000000 -- 1GB
AND start_time >= DATEADD('day', -7, CURRENT_TIMESTAMP())
ORDER BY bytes_scanned DESC;
-- 4. New users created
SELECT user_name as created_by, LEFT(query_text, 150), start_time
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE query_type = 'CREATE_USER'
AND start_time >= DATEADD('day', -7, CURRENT_TIMESTAMP())
;
-- 5. New integrations/applications
SELECT user_name, query_type, LEFT(query_text, 150), start_time
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE query_type IN ('CREATE_INTEGRATION', 'ALTER_INTEGRATION')
AND start_time >= DATEADD('day', -7, CURRENT_TIMESTAMP())
;
Output Format
Executive Summary
## Security Investigation Report
**Account**: [account_name]
**Timeframe**: [date range]
**Scan Type**: [Full / Focused]
### Critical Findings
[Immediate action required]
### High-Risk Findings
[Investigate within 24 hours]
### Medium-Risk Findings
[Review within 1 week]
### Recommendations
[Prioritized remediation steps]
When to Use
- Daily/weekly security investigation
- Incident response investigations
- Post-breach forensics
- Compliance audits (SOC 2, PCI, HIPAA)
- User access reviews
- Suspicious activity alerts
- Security posture assessments
Changelog
v1.0.0 (2026-03-17)
Initial Release:
- Created parent security-investigation skill
- Integrated three sub-skills:
- login-ip-anomaly: Authentication anomaly detection
- exfiltration-detection: Data theft detection (26 queries)
- Added MITRE ATT&CK mapping
- Added quick assessment queries
- Added full security scan workflow
1---2name: security-investigation3description: "Comprehensive Snowflake security investigation and threat detection. Use for: login anomalies, IP analysis, brute force detection, impossible travel, data exfiltration, bulk exports, unauthorized sharing, privilege escalation, RBAC violations, suspicious grants, backdoor accounts. This is the REQUIRED entry point for all security investigations. Routes to specialized sub-skills for focused analysis."4metadata:5 source: https://skillmd.com/skills/s-14-h/security-investigation6---78# Security Investigation910Comprehensive security investigation and threat detection for Snowflake environments.1112## Overview1314This skill provides a unified entry point for security investigations, routing to specialized sub-skills based on the detection type needed.1516### Sub-Skills1718| Sub-Skill | Purpose | Load When |19|-----------|---------|-----------|20| `login-ip-anomaly/SKILL.md` | Login anomalies, IP analysis, brute force, impossible travel | Authentication issues, suspicious logins |21| `exfiltration-detection/SKILL.md` | Data exports, sharing, external transfers, app integrations | Data theft investigation, bulk export alerts |22| `privilege-escalation/SKILL.md` | Role grants, user changes, RBAC violations, self-grants | Unauthorized access, privilege abuse |232425### Threat Coverage2627| Threat Category | Sub-Skill | Key Detections |28|-----------------|-----------|----------------|29| **Credential Attacks** | login-ip-anomaly | Brute force, credential stuffing, impossible travel |30| **Account Takeover** | login-ip-anomaly | New IPs, rapid IP changes, failed logins |31| **Data Theft** | exfiltration-detection | UNLOAD, COPY, GET, presigned URLs, large downloads |32| **Unauthorized Sharing** | exfiltration-detection | CREATE SHARE, listings, external accounts |33| **Supply Chain Risk** | exfiltration-detection | OAuth apps, native apps, external functions |34| **Privilege Abuse** | privilege-escalation | ACCOUNTADMIN grants, self-grants, ownership transfers |35| **Insider Threat** | privilege-escalation | New users, backdoor accounts, service accounts |36| **Persistence** | privilege-escalation | Role creation, user creation, ADMIN OPTION grants |373839### MITRE ATT&CK Mapping4041| Tactic | Technique | Sub-Skill | Detection |42|--------|-----------|-----------|-----------|43| Initial Access | Valid Accounts (T1078) | login-ip-anomaly | New IP, failed logins |44| Persistence | Create Account (T1136) | privilege-escalation | CREATE USER |45| Persistence | Account Manipulation (T1098) | privilege-escalation | ALTER USER, role grants |46| Privilege Escalation | Valid Accounts (T1078.004) | privilege-escalation | ACCOUNTADMIN grants |47| Defense Evasion | Indicator Removal (T1070) | privilege-escalation | DROP USER/ROLE |48| Collection | Data from Cloud Storage (T1530) | exfiltration-detection | Stage access, GET commands |49| Exfiltration | Transfer to Cloud Account (T1537) | exfiltration-detection | COPY to S3/Azure/GCS |50| Exfiltration | Exfiltration Over Web Service (T1567) | exfiltration-detection | External functions, APIs |5152---5354## Workflow5556### Step 1: Determine Investigation Type5758**Ask user:**59```60What type of security investigation do you need?611. Login & Authentication Anomalies (suspicious logins, brute force, impossible travel)622. Data Exfiltration Detection (bulk exports, sharing, external transfers)633. Privilege Escalation (role grants, user changes, RBAC violations)644. Full Security Scan (run all detections)65```6667**⚠️ STOP**: Wait for user response.6869### Step 2: Load Appropriate Sub-Skill7071Based on user selection:7273| Selection | Action |74|-----------|--------|75| Login & Authentication | Load `login-ip-anomaly/SKILL.md` |76| Data Exfiltration | Load `exfiltration-detection/SKILL.md` |77| Privilege Escalation | Load `privilege-escalation/SKILL.md` |78| Full Security Scan | Run all three sub-skills sequentially |7980### Step 3: Execute Sub-Skill Workflow8182Follow the loaded sub-skill's workflow:831. Select timeframe842. Run detection queries853. Analyze results864. Present findings875. Recommend actions8889---9091## Full Security Scan9293When running a full scan, execute in this order:9495### Phase 1: Privilege Escalation96Load `privilege-escalation/SKILL.md` and run:97- User/role creation detection98- Privileged role grants (ACCOUNTADMIN, SECURITYADMIN, etc.)99- Self-grants detection100- Current state audit101102### Phase 2: Login Anomalies103Load `login-ip-anomaly/SKILL.md` and run:104- IP baseline analysis105- New IP detection106- Rapid IP change detection107- Brute force detection108- Failed login analysis109110### Phase 3: Data Exfiltration111Load `exfiltration-detection/SKILL.md` and run:112- UNLOAD/COPY operations113- Stage and GET commands114- Data sharing activity115- Application/integration changes116- External table analysis117118---119120## Quick Assessment Queries121122For a rapid security check without loading sub-skills:123124### Critical Security Indicators125126```sql127-- 1. ACCOUNTADMIN grants in last 7 days128SELECT user_name, LEFT(query_text, 200), start_time129FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY130WHERE LOWER(query_text) LIKE '%grant%accountadmin%'131 AND query_type = 'GRANT'132 AND start_time >= DATEADD('day', -7, CURRENT_TIMESTAMP())133ORDER BY start_time DESC;134135-- 2. Failed logins from brute force IPs136SELECT client_ip, COUNT(*) as failures137FROM SNOWFLAKE.ACCOUNT_USAGE.LOGIN_HISTORY138WHERE is_success = 'NO'139 AND event_timestamp >= DATEADD('day', -7, CURRENT_TIMESTAMP())140GROUP BY client_ip141HAVING COUNT(*) >= 5142ORDER BY failures DESC;143144-- 3. Large data exports145SELECT user_name, query_type, bytes_scanned, rows_produced, start_time146FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY147WHERE query_type IN ('UNLOAD', 'COPY')148 AND bytes_scanned > 1000000000 -- 1GB149 AND start_time >= DATEADD('day', -7, CURRENT_TIMESTAMP())150ORDER BY bytes_scanned DESC;151152-- 4. New users created153SELECT user_name as created_by, LEFT(query_text, 150), start_time154FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY155WHERE query_type = 'CREATE_USER'156 AND start_time >= DATEADD('day', -7, CURRENT_TIMESTAMP())157;158159-- 5. New integrations/applications160SELECT user_name, query_type, LEFT(query_text, 150), start_time161FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY162WHERE query_type IN ('CREATE_INTEGRATION', 'ALTER_INTEGRATION')163 AND start_time >= DATEADD('day', -7, CURRENT_TIMESTAMP())164;165```166167---168169## Output Format170171### Executive Summary172173```174## Security Investigation Report175176**Account**: [account_name]177**Timeframe**: [date range]178**Scan Type**: [Full / Focused]179180### Critical Findings181[Immediate action required]182183### High-Risk Findings184[Investigate within 24 hours]185186### Medium-Risk Findings187[Review within 1 week]188189### Recommendations190[Prioritized remediation steps]191```192193---194195## When to Use196197- Daily/weekly security investigation198- Incident response investigations199- Post-breach forensics200- Compliance audits (SOC 2, PCI, HIPAA)201- User access reviews202- Suspicious activity alerts203- Security posture assessments204205---206207## Changelog208209### v1.0.0 (2026-03-17)210211**Initial Release:**212- Created parent security-investigation skill213- Integrated three sub-skills:214 - login-ip-anomaly: Authentication anomaly detection215 - exfiltration-detection: Data theft detection (26 queries)216- Added MITRE ATT&CK mapping217- Added quick assessment queries218- Added full security scan workflow