Detection rules › Elastic

Multiple Cloud Secrets Accessed by Source Address

Status
production
Severity
high
Time window
9m
Group by
source.ip
Author
Elastic
Source
github.com/elastic/detection-rules

This rule detects authenticated sessions accessing secret stores across multiple environments from the same source address within a short period of time, including cloud providers (AWS, GCP, Azure) and Kubernetes clusters. Adversaries with access to compromised credentials or session tokens may attempt to retrieve secrets from services such as AWS Secrets Manager, Google Secret Manager, Azure Key Vault, or Kubernetes Secrets in rapid succession to expand their access or exfiltrate sensitive information.

MITRE ATT&CK coverage

Rules detecting the same action

Other rules on this platform that filter on the same API call or operation.

Rule body elastic

[metadata]
creation_date = "2025/12/01"
integration = ["aws", "gcp", "azure", "kubernetes"]
maturity = "production"
updated_date = "2026/04/10"

[rule]
author = ["Elastic"]
description = """
This rule detects authenticated sessions accessing secret stores across multiple environments from the same source
address within a short period of time, including cloud providers (AWS, GCP, Azure) and Kubernetes clusters.
Adversaries with access to compromised credentials or session tokens may attempt to retrieve secrets from services such
as AWS Secrets Manager, Google Secret Manager, Azure Key Vault, or Kubernetes Secrets in rapid succession to expand
their access or exfiltrate sensitive information.
"""
from = "now-9m"
interval = "5m"
language = "esql"
license = "Elastic License v2"
name = "Multiple Cloud Secrets Accessed by Source Address"
note = """## Triage and analysis

### Multiple Cloud Secrets Accessed by Source Address

This alert identifies a single source IP address accessing secret-management APIs across **multiple cloud providers**
(e.g., AWS Secrets Manager, Google Secret Manager, Azure Key Vault) within a short timeframe.
This behavior is strongly associated with **credential theft, session hijacking, or token replay**, where an adversary
uses stolen authenticated sessions to harvest secrets across cloud environments.

Unexpected cross-cloud secret retrieval is uncommon and typically indicates automation misuse or malicious activity.

### Possible investigation steps

- Validate the principal
  - Identify the user, service account, workload identity, or application making the requests.
  - Confirm whether this identity is expected to operate across more than one cloud provider.
- Review related activity
  - Look for additional alerts involving the same identity, source IP, or token over the last 24–48 hours.
  - Identify whether the source IP has been observed performing unusual authentication, privilege escalation,
    or reconnaissance.
- Check application or service context
  - Determine whether any workload legitimately pulls secrets from multiple cloud providers.
  - Review deployment pipelines or integration layers that might legitimately bridge AWS, Azure, and GCP.
- Analyze user agent and invocation patterns
  - Compare `user_agent.original` or equivalent fields against expected SDKs or automation tools.
  - Suspicious indicators include CLI tools, unknown libraries, browser user agents, or custom scripts.
- Inspect IP reputation and origin
  - Determine whether the source IP corresponds to a managed workload (EC2, GCE, Azure VM) or an unexpected host.
  - Validate that the associated instance or host is under your control and behaving normally.
- Review IAM permissions and accessed secrets
  - Check the policies attached to the identity.
  - Verify whether the accessed secrets are sensitive, unused, or unrelated to the identity’s purpose.
- Assess potential compromise scope
  - If compromise is suspected, enumerate other assets accessed by the same identity in the last 24 hours.
  - Look for lateral movement, privilege escalation, or abnormal API usage.
- Review Kubernetes activity
  - Identify the Kubernetes user, service account, or workload performing the secret access.
  - Determine whether the access originated from a pod, node, or external client.
  - Validate whether the identity is expected to access secrets in the affected namespaces.
  - Investigate whether the activity corresponds to application behavior or manual/API access.

### False positive analysis

- Validate whether the source IP is associated with a legitimate multi-cloud orchestration tool, automation pipeline,
  or shared CI/CD system.
- Confirm that the identity is authorized to access secrets across multiple cloud services.
- If activity is expected, consider adding exceptions that pair account identity, source IP, and expected user agent
  to reduce noise.
- Determine whether the source IP is associated with Kubernetes nodes, controllers, or internal workloads
  that legitimately retrieve secrets alongside cloud provider integrations.

### Response and remediation

- Initiate incident response** if the activity is unauthorized or suspicious.
- Restrict or disable** the affected credentials or service accounts.
- Rotate all accessed secrets** and review other secrets the identity can access.
- Analyze systems** that may have leaked credentials, such as compromised hosts or exposed tokens.
- Harden identity security:
  - Enforce MFA for users where applicable.
  - Reduce permissions to least privilege.
  - Review trust relationships, workload identities, and cross-cloud integrations.
- Search for persistence mechanisms** such as newly created keys, roles, or service accounts.
- If Kubernetes access is involved:
  - Rotate Kubernetes secrets and service account tokens.
  - Review RBAC permissions and restrict secret access to least privilege.
  - Inspect affected pods or nodes for compromise.
- Improve monitoring and audit visibility** by ensuring logging is enabled across all cloud environments.
- Determine root cause** (phishing, malware, token replay, exposed credential, etc.) and close the vector to prevent recurrence.
"""
references = [
    "https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html",
    "https://docs.cloud.google.com/secret-manager/docs/samples/secretmanager-access-secret-version",
    "https://learn.microsoft.com/en-us/azure/key-vault/secrets/about-secrets",
    "https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack",
]
risk_score = 73
rule_id = "472b4944-d810-43cf-83dc-7d080ae1b8dd"
setup = """
This multi-datasource rule relies on additional configurations from each hyperscaler.

- GCP Audit: [Enable DATA_READ for the Secret Manager API service](https://docs.cloud.google.com/logging/docs/audit/configure-data-access)
- Azure: [Enable Diagnostic Logging for the Key Vault Service](https://learn.microsoft.com/en-us/azure/key-vault/general/howto-logging?tabs=azure-cli)
- AWS: Secrets Manager read access is automatically logged by CloudTrail.
"""
severity = "high"
tags = [
    "Domain: Cloud",
    "Domain: IAM",
    "Domain: Storage",
    "Data Source: AWS",
    "Data Source: Amazon Web Services",
    "Data Source: AWS Secrets Manager",
    "Data Source: Azure",
    "Data Source: Azure Activity Logs",
    "Data Source: GCP",
    "Data Source: Google Cloud Platform",
    "Data Source: Kubernetes",
    "Tactic: Credential Access",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
FROM logs-azure.platformlogs-*, logs-aws.cloudtrail-*, logs-gcp.audit-*, logs-kubernetes.audit_logs-* METADATA _id, _version, _index 
| WHERE 
  ( 
    /* AWS Secrets Manager */ 
    (data_stream.dataset == "aws.cloudtrail" AND event.action == "GetSecretValue") OR 
    
    // Azure Key Vault (platform logs)
    (data_stream.dataset == "azure.platformlogs" AND event.action IN ("SecretGet", "KeyGet")) or 
    
    /* Google Secret Manager */ 
    (data_stream.dataset IN ("googlecloud.audit", "gcp.audit") AND 
     event.action IN ("google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion", "google.cloud.secretmanager.v1.SecretManagerService.GetSecretRequest")) OR 

    /* Kubernetes Secrets */
    (data_stream.dataset == "kubernetes.audit_logs" AND kubernetes.audit.objectRef.resource == "secrets" AND kubernetes.audit.verb IN ("get", "list"))

   ) AND source.ip IS NOT NULL

// Cloud vendor label based on dataset
| EVAL Esql.cloud_vendor = CASE(
    data_stream.dataset == "aws.cloudtrail", "aws",
    data_stream.dataset == "azure.platformlogs", "azure",
    data_stream.dataset IN ("googlecloud.audit","gcp.audit"), "gcp",
    data_stream.dataset == "kubernetes.audit_logs", "k8s",
    "unknown"
  )
// Vendor+tenant label, e.g. aws:123456789012, azure:tenant, gcp:project
| EVAL Esql.tenant_label = CASE(
    Esql.cloud_vendor == "aws", CONCAT("aws:", cloud.account.id),
    Esql.cloud_vendor == "azure", CONCAT("azure:", cloud.account.id),
    Esql.cloud_vendor == "gcp", CONCAT("gcp:", cloud.account.id),
    Esql.cloud_vendor == "k8s", CONCAT("k8s:", orchestrator.cluster.name),
    "unknown"
  )
| WHERE Esql.cloud_vendor != "unknown"
| STATS
    // Core counts
    Esql.events_count = COUNT(*),
    Esql.vendor_count_distinct = COUNT_DISTINCT(Esql.cloud_vendor),
    // Action & data source context
    Esql.event_action_values = VALUES(event.action),
    Esql.data_source_values = VALUES(data_stream.dataset),
    // Cloud vendor + tenant context
    Esql.cloud_vendor_values = VALUES(Esql.cloud_vendor),
    Esql.tenant_label_values = VALUES(Esql.tenant_label),
    // Hyperscaler-specific IDs
    Esql.aws_account_id_values = VALUES(CASE(Esql.cloud_vendor == "aws", cloud.account.id, "unknown")),
    Esql.azure_tenant_id_values = VALUES(CASE(Esql.cloud_vendor == "azure", cloud.account.id, "unknown")),
    Esql.gcp_project_id_values = VALUES(CASE(Esql.cloud_vendor == "gcp", cloud.account.id, "unknown")),
    // Generic cloud metadata
    Esql.cloud_region_values = VALUES(cloud.region),
    Esql.k8s_namespace_values = VALUES(kubernetes.audit.objectRef.namespace),
    // Namespace values
    Esql.data_stream_namespace_values = VALUES(data_stream.namespace), 
    Esql_priv.user_name_values = VALUES(user.name)
  BY source.ip
// Require multi-vendor cred-access from same source IP
| WHERE Esql.vendor_count_distinct >= 2
| SORT Esql.events_count DESC
| KEEP Esql.*, Esql_priv.*, source.ip
'''



[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1555"
name = "Credentials from Password Stores"
reference = "https://attack.mitre.org/techniques/T1555/"
[[rule.threat.technique.subtechnique]]
id = "T1555.006"
name = "Cloud Secrets Management Stores"
reference = "https://attack.mitre.org/techniques/T1555/006/"



[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"

Stages and Predicates

Stage 1: from

FROM logs-azure.platformlogs-*, logs-aws.cloudtrail-*, logs-gcp.audit-*, logs-kubernetes.audit_logs-* METADATA _id, _version, _index

Stage 2: where

| WHERE
  (
    (data_stream.dataset == "aws.cloudtrail" AND event.action == "GetSecretValue") OR
    (data_stream.dataset == "azure.platformlogs" AND event.action IN ("SecretGet", "KeyGet")) or
    (data_stream.dataset IN ("googlecloud.audit", "gcp.audit") AND
     event.action IN ("google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion", "google.cloud.secretmanager.v1.SecretManagerService.GetSecretRequest")) OR
    (data_stream.dataset == "kubernetes.audit_logs" AND kubernetes.audit.objectRef.resource == "secrets" AND kubernetes.audit.verb IN ("get", "list"))
   ) AND source.ip IS NOT NULL

Stage 3: eval

| EVAL Esql.cloud_vendor = CASE(
    data_stream.dataset == "aws.cloudtrail", "aws",
    data_stream.dataset == "azure.platformlogs", "azure",
    data_stream.dataset IN ("googlecloud.audit","gcp.audit"), "gcp",
    data_stream.dataset == "kubernetes.audit_logs", "k8s",
    "unknown"
  )
Esql.cloud_vendor =
ifdata_stream.dataset == "aws.cloudtrail""aws"
elifdata_stream.dataset == "azure.platformlogs""azure"
elifdata_stream.dataset IN ("googlecloud.audit","gcp.audit")"gcp"
elifdata_stream.dataset == "kubernetes.audit_logs""k8s"
else"unknown"

Stage 4: eval

| EVAL Esql.tenant_label = CASE(
    Esql.cloud_vendor == "aws", CONCAT("aws:", cloud.account.id),
    Esql.cloud_vendor == "azure", CONCAT("azure:", cloud.account.id),
    Esql.cloud_vendor == "gcp", CONCAT("gcp:", cloud.account.id),
    Esql.cloud_vendor == "k8s", CONCAT("k8s:", orchestrator.cluster.name),
    "unknown"
  )
Esql.tenant_label =
ifEsql.cloud_vendor == "aws"CONCAT("aws:", cloud.account.id)
elifEsql.cloud_vendor == "azure"CONCAT("azure:", cloud.account.id)
elifEsql.cloud_vendor == "gcp"CONCAT("gcp:", cloud.account.id)
elifEsql.cloud_vendor == "k8s"CONCAT("k8s:", orchestrator.cluster.name)
else"unknown"

Stage 5: where

| WHERE Esql.cloud_vendor != "unknown"

Stage 6: stats

| STATS
    Esql.events_count = COUNT(*),
    Esql.vendor_count_distinct = COUNT_DISTINCT(Esql.cloud_vendor),
    Esql.event_action_values = VALUES(event.action),
    Esql.data_source_values = VALUES(data_stream.dataset),
    Esql.cloud_vendor_values = VALUES(Esql.cloud_vendor),
    Esql.tenant_label_values = VALUES(Esql.tenant_label),
    Esql.aws_account_id_values = VALUES(CASE(Esql.cloud_vendor == "aws", cloud.account.id, "unknown")),
    Esql.azure_tenant_id_values = VALUES(CASE(Esql.cloud_vendor == "azure", cloud.account.id, "unknown")),
    Esql.gcp_project_id_values = VALUES(CASE(Esql.cloud_vendor == "gcp", cloud.account.id, "unknown")),
    Esql.cloud_region_values = VALUES(cloud.region),
    Esql.k8s_namespace_values = VALUES(kubernetes.audit.objectRef.namespace),
    Esql.data_stream_namespace_values = VALUES(data_stream.namespace),
    Esql_priv.user_name_values = VALUES(user.name)
  BY source.ip

Stage 7: where

| WHERE Esql.vendor_count_distinct >= 2

Stage 8: sort

| SORT Esql.events_count DESC

Stage 9: keep

| KEEP Esql.*, Esql_priv.*, source.ip

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
Esql.cloud_vendorne
  • unknown
Esql.vendor_count_distinctge
  • 2
data_stream.dataseteq
  • aws.cloudtrail
  • azure.platformlogs
  • kubernetes.audit_logs
data_stream.datasetin
  • gcp.audit
  • googlecloud.audit
event.actioneq
  • GetSecretValue
event.actionin
  • KeyGet
  • SecretGet
  • google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion
  • google.cloud.secretmanager.v1.SecretManagerService.GetSecretRequest
kubernetes.audit.objectRef.resourceeq
  • secrets
kubernetes.audit.verbin
  • get
  • list
source.ipis_not_null
  • (no value, null check)

Output fields

Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.

FieldSource
Esql.*KEEP Esql.*
Esql_priv.*KEEP Esql_priv.*
source.ipKEEP source.ip