Kubectl Permission Discovery
This rule detects the use of the "kubectl auth --can-i" command, which is used to check permissions in Kubernetes clusters. Attackers may use this command to enumerate permissions and discover potential misconfigurations in the cluster, allowing them to gain unauthorized access or escalate privileges.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2025/06/17"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2025/06/17"
6
7[rule]
8author = ["Elastic"]
9description = """
10This rule detects the use of the "kubectl auth --can-i" command, which is used to check permissions in Kubernetes clusters.
11Attackers may use this command to enumerate permissions and discover potential misconfigurations in the cluster, allowing
12them to gain unauthorized access or escalate privileges.
13"""
14from = "now-9m"
15index = [
16 "logs-endpoint.events.process*",
17]
18language = "eql"
19license = "Elastic License v2"
20name = "Kubectl Permission Discovery"
21references = [
22 "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_auth/kubectl_auth_can-i/",
23 ]
24risk_score = 21
25rule_id = "1600f9e2-5be6-4742-8593-1ba50cd94069"
26setup = """## Setup
27
28This rule requires data coming in from Elastic Defend.
29
30### Elastic Defend Integration Setup
31Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
32
33#### Prerequisite Requirements:
34- Fleet is required for Elastic Defend.
35- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
36
37#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
38- Go to the Kibana home page and click "Add integrations".
39- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
40- Click "Add Elastic Defend".
41- Configure the integration name and optionally add a description.
42- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
43- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
44- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
45- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
46For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
47- Click "Save and Continue".
48- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
49For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
50"""
51severity = "low"
52tags = [
53 "Domain: Endpoint",
54 "Domain: Container",
55 "OS: Linux",
56 "Use Case: Threat Detection",
57 "Tactic: Discovery",
58 "Data Source: Elastic Defend",
59]
60timestamp_override = "event.ingested"
61type = "eql"
62query = '''
63process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
64process.name == "kubectl" and process.args == "auth" and process.args == "can-i"
65'''
66
67[[rule.threat]]
68framework = "MITRE ATT&CK"
69
70[[rule.threat.technique]]
71id = "T1613"
72name = "Container and Resource Discovery"
73reference = "https://attack.mitre.org/techniques/T1613/"
74
75[rule.threat.tactic]
76id = "TA0007"
77name = "Discovery"
78reference = "https://attack.mitre.org/tactics/TA0007/"
References
Related rules
- Docker Socket Enumeration
- Suspicious Kernel Feature Activity
- Manual Mount Discovery via /etc/exports or /etc/fstab
- Docker Release File Creation
- Suspicious /proc/maps Discovery