Databricks TruffleHog Scan Detected
Description
Detects TruffleHog secret scanning activity in Databricks. TruffleHog is a tool used to scan repositories and systems for exposed credentials and secrets. While it can be used legitimately for security audits, unauthorized scanning may indicate credential harvesting attempts. External IP sources are elevated to HIGH severity.
Query · python
import ipaddress
from panther_databricks_helpers import databricks_alert_context, filter_noise
def rule(event):
# Filter out system noise
if filter_noise(event):
return False
# Check user agent for TruffleHog signature
user_agent = event.get("userAgent", "")
return "TruffleHog" in user_agent
def title(event):
source_ip = event.get("sourceIPAddress", "Unknown IP")
user = event.deep_get("userIdentity", "email", default="Unknown User")
return f"TruffleHog secret scan detected from {source_ip} (User: {user})"
def severity(event):
source_ip = event.get("sourceIPAddress", "")
# Lower severity for scans from private IPs (internal testing)
if source_ip:
try:
if ipaddress.ip_address(source_ip).is_private:
return "MEDIUM"
except ValueError:
# Invalid IP format, treat as public (HIGH severity)
pass
return "HIGH"
def alert_context(event):
return databricks_alert_context(
event,
additional_fields={
"token_id": event.deep_get("requestParams", "tokenId"),
"user_agent_full": event.get("userAgent"),
},
)
Analyst notes
- Query audit logs for all secret access attempts (getSecret action) by this user in the 24 hours before and after the TruffleHog scan
- Check if the source IP (sourceIPAddress) matches known security scanning tools or is from an unexpected geographic location
- Find all other unusual secret access patterns from this IP or user in the past 7 days