Kubernetes Anonymous Request Authorized

This rule detects when an unauthenticated user request is authorized within the cluster. Attackers may attempt to use anonymous accounts to gain initial access to the cluster or to avoid attribution of their activities within the cluster. This rule excludes the /healthz, /livez and /readyz endpoints which are commonly accessed anonymously.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2022/09/13"
 3integration = ["kubernetes"]
 4maturity = "production"
 5updated_date = "2024/05/21"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10This rule detects when an unauthenticated user request is authorized within the cluster. Attackers may attempt to use
11anonymous accounts to gain initial access to the cluster or to avoid attribution of their activities within the cluster.
12This rule excludes the /healthz, /livez and /readyz endpoints which are commonly accessed anonymously.
13"""
14false_positives = [
15    """
16    Anonymous access to the API server is a dangerous setting enabled by default. Common anonymous connections (e.g.,
17    health checks) have been excluded from this rule. All other instances of authorized anonymous requests should be
18    investigated.
19    """,
20]
21index = ["logs-kubernetes.*"]
22language = "kuery"
23license = "Elastic License v2"
24name = "Kubernetes Anonymous Request Authorized"
25note = """## Setup
26
27The Kubernetes Fleet integration with Audit Logs enabled or similarly structured data is required to be compatible with this rule."""
28references = [
29    "https://media.defense.gov/2022/Aug/29/2003066362/-1/-1/0/CTR_KUBERNETES_HARDENING_GUIDANCE_1.2_20220829.PDF",
30]
31risk_score = 47
32rule_id = "63c057cc-339a-11ed-a261-0242ac120002"
33severity = "medium"
34tags = ["Data Source: Kubernetes", "Tactic: Execution", "Tactic: Initial Access", "Tactic: Defense Evasion"]
35timestamp_override = "event.ingested"
36type = "query"
37
38query = '''
39event.dataset:kubernetes.audit_logs
40  and kubernetes.audit.annotations.authorization_k8s_io/decision:allow
41  and kubernetes.audit.user.username:("system:anonymous" or "system:unauthenticated" or not *)
42  and not kubernetes.audit.requestURI:(/healthz* or /livez* or /readyz*)
43'''
44
45
46[[rule.threat]]
47framework = "MITRE ATT&CK"
48[[rule.threat.technique]]
49id = "T1078"
50name = "Valid Accounts"
51reference = "https://attack.mitre.org/techniques/T1078/"
52[[rule.threat.technique.subtechnique]]
53id = "T1078.001"
54name = "Default Accounts"
55reference = "https://attack.mitre.org/techniques/T1078/001/"
56
57
58
59[rule.threat.tactic]
60id = "TA0001"
61name = "Initial Access"
62reference = "https://attack.mitre.org/tactics/TA0001/"

Setup

The Kubernetes Fleet integration with Audit Logs enabled or similarly structured data is required to be compatible with this rule.

References

Related rules

to-top