[Rule Tuning] GKE Forbidden Request from Unusual User Agent
Link to Rule
https://github.com/elastic/detection-rules/blob/main/rules/integrations/gcp/execution_gcp_gke_forbidden_request_from_unusual_user_agent.toml
Rule Tuning Type
False Positives - Reducing benign events mistakenly identified as threats.
Description
This rule generates false positives whenever a command also fails, even if it's not due to being "forbidden" or unauthed.
I think the issue is the query: data_stream.dataset:gcp.audit and service.name:k8s.io and event.outcome:failure and ... uses event.outcome:failure, which happens even if a request is granted but fails due to some other reason. This results in false positives.
What I've been seeing is users which should have permission to perform a certain action causing this rule to fire, even when gcp.audit.authorization_info.granted is true, or gcp.audit.labels.authorization.k8s.io/decision is allow.
I've finally seen this in even some of my own actions where the action failed, but I had full permission to perform the action. A subsequent retry of the action worked, proving I had access, yet still one of these alerts raised due to the command failure.
Unfortunately gcp.audit.authorization_info.granted doesn't seem to be an option we can use when updating the rule, possibly it's not mapped, but I found data_stream.dataset:gcp.audit and service.name:k8s.io and gcp.audit.status.code: (7 or 16) and ... may work.
Code 7 and 16 are for PERMISSION_DENIED and UNAUTHENTICATED respectively. Not sure if this would be a more accurate field to use or not??
Example Data
No response
Hi @terrancedejesus, I'd like to pick this up. Plan: in rules/integrations/gcp/execution_gcp_gke_forbidden_request_from_unusual_user_agent.toml, narrow event.outcome:failure to authorization failures only, for example gcp.audit.status.code:(7 or 16) (PERMISSION_DENIED, UNAUTHENTICATED) as the reporter suggests, keep the user-agent and system-account exclusions, and bump updated_date. I'll run the repo's unit tests and schema validation to make sure the field resolves for the gcp integration. Would you prefer gcp.audit.status.code here, or the authorization.k8s.io/decision audit label? Could you assign it to me?