Snowflake to SIEM
Snowflake can raise the incident itself
Detect failed password logins and alert Splunk, Sentinel or any XDR within minutes.
Kevin Keller · kevinkeller.org
Why it matters
React fast, without exporting logs
- No log export pipeline to run
- No extra code to host and maintain outside Snowflake
- Incidents reach the SIEM in a timely, automated way
- The pattern works on any data in Snowflake, including third-party logs
The use case
Some service accounts still need passwords
- Where OAuth or key-pair authentication is not possible
- For example, Power BI Cloud Service connecting from changing public IPs
- Network policies are hard to set for those users
For these users, a single failed login should already raise an alarm.
How it works
Two tasks, one table, one API call
- An alert runs every minute and checks the last five minutes of login history
- New failed password logins are recorded in
LOGIN_EVENTS, once per event ID - A second task sends unsent events to the SIEM API
- Each row is marked
SENT, with a timestamp and the SIEM's response
The key design choice
Overlapping checks, no duplicate incidents
The alert may see the same event several times. Each failed login has a unique event ID, so it is only recorded once.
The building blocks
All native Snowflake objects
- Alert:
strange_login, every minute - View: failed password logins in the last five minutes
- External access function: a Python UDF that posts to the SIEM
- Task: calls the send procedure every minute
Least privilege
Don't run it as ACCOUNTADMIN
- Use ACCOUNTADMIN only temporarily during setup
- Create a dedicated
SIEM_MONITORrole - Grant
MONITORon the users you want to watch - Revoke the temporary grants afterwards
Going to production
Adapt the demo to your SIEM
- Replace the mock API with your SIEM's incident endpoint and token
- Adapt the JSON payload to what the SIEM expects
- Consider private connectivity, or a proxy API in a DMZ
- Let the SIEM respond: disable the user, pull related logs
Where next
Beyond failed logins
- Have Snowflake deactivate the user first
- Watch for sensitive changes, such as network policies
- Monitor container logs from an event table
- Ingest other applications' logs and hunt in SQL or Python
Takeaway
Detection and alerting can run where the logs already are.
Kevin Keller · kevinkeller.org