let r_tbl = dynamic(['table_name']);
Snowflake
| where QUERY_TYPE_s =~ 'SELECT'
| where EXECUTION_STATUS_s =~ 'SUCCESS'
| extend tbl = extract(@'(FROM|from)\s(\S+)\s', 2, QUERY_TEXT_s)
| where tbl in~ (r_tbl)
| extend AccountCustomEntity = TargetUsername
relevantTechniques:
- T1119
name: Snowflake - Query on sensitive or restricted table
requiredDataConnectors:
- dataTypes:
- Snowflake
connectorId: Snowflake
entityMappings:
- fieldMappings:
- identifier: Name
columnName: AccountCustomEntity
entityType: Account
triggerThreshold: 0
id: f258fa0c-e26c-4e2b-94fb-88b6cef0ca6e
tactics:
- Collection
version: 1.0.0
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Snowflake/Analytic Rules/SnowflakeQueryOnSensitiveTable.yaml
queryPeriod: 1h
kind: Scheduled
queryFrequency: 1h
severity: Medium
status: Available
description: |
'Detects query on sensitive or restricted table.'
query: |
let r_tbl = dynamic(['table_name']);
Snowflake
| where QUERY_TYPE_s =~ 'SELECT'
| where EXECUTION_STATUS_s =~ 'SUCCESS'
| extend tbl = extract(@'(FROM|from)\s(\S+)\s', 2, QUERY_TEXT_s)
| where tbl in~ (r_tbl)
| extend AccountCustomEntity = TargetUsername
triggerOperator: gt
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspace": {
"type": "String"
}
},
"resources": [
{
"apiVersion": "2024-01-01-preview",
"id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/f258fa0c-e26c-4e2b-94fb-88b6cef0ca6e')]",
"kind": "Scheduled",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/f258fa0c-e26c-4e2b-94fb-88b6cef0ca6e')]",
"properties": {
"alertRuleTemplateName": "f258fa0c-e26c-4e2b-94fb-88b6cef0ca6e",
"customDetails": null,
"description": "'Detects query on sensitive or restricted table.'\n",
"displayName": "Snowflake - Query on sensitive or restricted table",
"enabled": true,
"entityMappings": [
{
"entityType": "Account",
"fieldMappings": [
{
"columnName": "AccountCustomEntity",
"identifier": "Name"
}
]
}
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Snowflake/Analytic Rules/SnowflakeQueryOnSensitiveTable.yaml",
"query": "let r_tbl = dynamic(['table_name']);\nSnowflake\n| where QUERY_TYPE_s =~ 'SELECT'\n| where EXECUTION_STATUS_s =~ 'SUCCESS'\n| extend tbl = extract(@'(FROM|from)\\s(\\S+)\\s', 2, QUERY_TEXT_s)\n| where tbl in~ (r_tbl)\n| extend AccountCustomEntity = TargetUsername\n",
"queryFrequency": "PT1H",
"queryPeriod": "PT1H",
"severity": "Medium",
"status": "Available",
"subTechniques": [],
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"Collection"
],
"techniques": [
"T1119"
],
"templateVersion": "1.0.0",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0
},
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
}
]
}