-
Notifications
You must be signed in to change notification settings - Fork 587
[New Rule] Kubernetes Unusual Decision by User Agent #4829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Aegrah
wants to merge
6
commits into
main
Choose a base branch
from
unusual-user-agent-decision
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+51
−0
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e69b510
[New Rule] Kubernetes Unusual Request Response by User Agent
Aegrah bec7f3e
++
Aegrah bc95b36
Update execution_unusual_request_response_by_user_agent.toml
Aegrah 15bcc6a
Update rules/integrations/kubernetes/execution_unusual_request_respon…
Aegrah da7949f
Update execution_unusual_request_response_by_user_agent.toml
Aegrah 5cc61ae
Update rules/integrations/kubernetes/execution_unusual_request_respon…
Aegrah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
rules/integrations/kubernetes/execution_unusual_request_response_by_user_agent.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
[metadata] | ||
creation_date = "2025/06/18" | ||
integration = ["kubernetes"] | ||
maturity = "production" | ||
updated_date = "2025/06/18" | ||
|
||
[rule] | ||
author = ["Elastic"] | ||
description = """ | ||
This rule detects unusual request responses in Kubernetes audit logs through the use of the | ||
"new_terms" rule type. In production environments, default API requests are typically made by | ||
system components or trusted users, who are expected to have a consistent user agent and | ||
allowed response annotations. By monitoring for anomalies in the username and response | ||
annotations, this rule helps identify potential unauthorized access or misconfigurations | ||
in the Kubernetes environment. | ||
""" | ||
index = ["logs-kubernetes.audit_logs-*"] | ||
language = "kuery" | ||
license = "Elastic License v2" | ||
name = "Kubernetes Unusual Decision by User Agent" | ||
risk_score = 21 | ||
rule_id = "8a1db198-da6f-4500-b985-7fe2457300af" | ||
severity = "low" | ||
tags = [ | ||
"Domain: Kubernetes", | ||
"Domain: Container", | ||
"Use Case: Threat Detection", | ||
"Data Source: Kubernetes", | ||
"Tactic: Execution" | ||
] | ||
timestamp_override = "event.ingested" | ||
type = "new_terms" | ||
query = ''' | ||
host.os.type:"linux" and event.dataset:"kubernetes.audit_logs" and kubernetes.audit.stage:"ResponseComplete" and user_agent.original:* | ||
''' | ||
|
||
[[rule.threat]] | ||
framework = "MITRE ATT&CK" | ||
|
||
[rule.threat.tactic] | ||
id = "TA0002" | ||
name = "Execution" | ||
reference = "https://attack.mitre.org/tactics/TA0002/" | ||
|
||
[rule.new_terms] | ||
field = "new_terms_fields" | ||
value = ["kubernetes.audit.annotations.authorization_k8s_io/decision", "kubernetes.audit.user.username", "user_agent.original"] | ||
|
||
[[rule.new_terms.history_window_start]] | ||
field = "history_window_start" | ||
value = "now-10d" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we intentionally exclude
from
rule object?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good question. I copy pasted the template from the other k8s rules. I just did a check in the kubernetes repository, and the
from
field is nowhere present.@imays11 do you happen to know why this is not set? Is this related to timestamps in the audit log file system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value (if not specified) for it is
now-6m
afaik