Skip to content
Threat Feed
low advisory

Kubernetes Secret Access via Unusual User Agent

This rule detects when secrets are accessed via an unusual user agent, user name, and source IP in a Kubernetes cluster, indicating potential credential access attempts by attackers seeking sensitive information.

Triage facts

Revision 2
Evidence
Unknown
Severity
Low
Sources
4 public sources
Freshness
Revision 2Mar 26, 16:16 UTC
Detection
2 rules
Revision history 1 entry · Revision 2
  1. Revision 2

    Repaired a legacy canonical identity collision

    Changed: slug

This detection rule focuses on identifying unusual access patterns to secrets within a Kubernetes environment. After gaining initial access to a Kubernetes cluster, attackers often target stored secrets to escalate privileges and access sensitive information such as credentials, API keys, and other confidential data. The rule leverages Kubernetes audit logs to monitor API requests for secret retrieval ("get" or "list" actions) and flags instances where the requests originate from an unexpected user agent, source IP, or user name. This helps identify potentially malicious actors attempting to compromise the cluster by exploiting unsecured credentials. The rule is designed to detect deviations from established access patterns.

Attack Chain

  1. Attacker gains initial access to a Kubernetes cluster, possibly through exploiting a vulnerability in a deployed application or by compromising a service account.
  2. The attacker enumerates available resources within the cluster, including secrets, to identify potential targets for credential harvesting.
  3. The attacker crafts an API request to retrieve the contents of a targeted secret. This request may use kubectl or the Kubernetes API directly.
  4. The API request is sent to the Kubernetes API server, specifying the get or list verb and the name of the targeted secret resource.
  5. Kubernetes audit logging captures the API request, including details about the source IP address, user agent, user name, and the requested resource.
  6. The detection rule analyzes the audit log data and flags any requests originating from an unusual user agent, IP address, or user name that deviates from the established baseline.
  7. If the API request is authorized, the API server retrieves the secret data from the etcd datastore and returns it to the attacker.
  8. The attacker uses the retrieved secrets to gain access to other systems, services, or data within or outside the Kubernetes environment.

Impact

Compromise of Kubernetes secrets can lead to widespread damage, including unauthorized access to sensitive data, lateral movement within the cluster, and exfiltration of confidential information. Successful exploitation can grant attackers persistent access to the environment and allow them to disrupt critical services. The severity of the impact depends on the sensitivity of the information stored in the compromised secrets.

Recommendation

  • Deploy the Sigma rule "Kubernetes Secret Access via Unusual User Agent" to your SIEM and tune the new_terms_fields value in the rule to match your environment.
  • Investigate any alerts generated by the Sigma rule, paying close attention to the source IP address, user agent, and user name associated with the secret access attempt.
  • Implement strong authentication and authorization controls for Kubernetes API access to prevent unauthorized users from retrieving secrets (reference: MITRE ATT&CK T1552.007).
  • Regularly rotate Kubernetes secrets and store them securely using a dedicated secrets management solution.
  • Monitor Kubernetes audit logs for suspicious activity related to secret access (Data Source: Kubernetes).

Detection coverage 2

Kubernetes Secret Accessed from Outside Pod

medium

Detects secret access events originating from outside of a pod within the cluster.

sigma tactics: credential_access techniques: T1552.007 sources: network_connection, kubernetes

Kubernetes Secret Access via Unusual User Agent

low

Detects Kubernetes secret access events with unusual user agents.

sigma tactics: credential_access techniques: T1552 sources: webserver, kubernetes

Detection queries are available on the platform. Get full rules →