Detection rules › Panther
GCP K8s Pod Using Host PID Namespace
This detection monitors for any pod creation or modification using the host PID namespace. The Host PID namespace enables a pod and its containers to have direct access and share the same view as of the host’s processes. This can offer a powerful escape hatch to the underlying host.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | T1610 Deploy Container |
| Privilege Escalation | T1611 Escape to Host |
Rules detecting the same action
Other rules on this platform that filter on the same API call or operation.
Rule body yaml
AnalysisType: rule
RuleID: "GCP.K8s.Pod.Using.Host.PID.Namespace"
DisplayName: "GCP K8s Pod Using Host PID Namespace"
Enabled: false
Status: Deprecated
Filename: gcp_k8s_pod_using_host_pid_namespace.py
LogTypes:
- GCP.AuditLog
Tags:
- Deprecated
- GCP
- Optional
Severity: Medium
Description:
This detection monitors for any pod creation or modification using the host PID namespace. The Host
PID namespace enables a pod and its containers to have direct access and share the same view as of the host’s
processes. This can offer a powerful escape hatch to the underlying host.
Runbook:
Investigate a reason of creating a pod using the host PID namespace. Advise that it is discouraged
practice. Create ticket if appropriate.
Reports:
MITRE ATT&CK:
- TA0004:T1611 # Escape to Host
- TA0002:T1610 # Deploy Container
Reference: https://medium.com/snowflake/from-logs-to-detection-using-snowflake-and-panther-to-detect-k8s-threats-d72f70a504d7
Tests:
- Name: triggers
ExpectedResult: true
Log:
{
"authorizationInfo":
[
{
"granted": true,
"permission": "io.k8s.core.v1.pods.create",
"resource": "core/v1/namespaces/default/pods/nginx-test",
},
],
"protoPayload":
{
"methodName": "io.k8s.core.v1.pods.create",
"request": { "spec": { "hostPID": true } },
},
}
- Name: ignore
ExpectedResult: false
Log:
{
"authorizationInfo":
[
{
"granted": true,
"permission": "io.k8s.core.v1.pods.create",
"resource": "core/v1/namespaces/default/pods/nginx-test",
},
],
"protoPayload":
{
"methodName": "io.k8s.core.v1.pods.create",
"request": { "spec": { "hostPID": false } },
},
}
Detection logic
Condition
protoPayload.request.spec.hostPID eq "True" or protoPayload.response.spec.hostPID eq "True"
protoPayload.methodName in ["io.k8s.core.v1.pods.create", "io.k8s.core.v1.pods.update", "io.k8s.core.v1.pods.patch"]
not (protoPayload.authenticationInfo.principalEmail is_not_null and (protoPayload.authenticationInfo.principalEmail starts_with "system:kube-controller-manager" or protoPayload.authenticationInfo.principalEmail starts_with "system:kube-scheduler" or protoPayload.authenticationInfo.principalEmail starts_with "system:addon-manager" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:kube-system:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:kube-public:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:kube-node-lease:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:gke-system:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:gke-managed-system:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:gmp-system:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:gmp-public:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:config-management-system:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:istio-system:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:asm-system:"))
protoPayload.resourceName not is_not_null
This rule also runs imperative logic the parser cannot express as a filter; the conditions above are the structured part it could extract.
Exclusions
Top-level NOT(...) conjuncts: predicates this rule actively suppresses.
| Field | Kind | Excluded values |
|---|---|---|
protoPayload.authenticationInfo.principalEmail | starts_with | system:addon-manager |
protoPayload.authenticationInfo.principalEmail | starts_with | system:kube-controller-manager |
protoPayload.authenticationInfo.principalEmail | starts_with | system:kube-scheduler |
protoPayload.authenticationInfo.principalEmail | starts_with | system:serviceaccount:asm-system: |
protoPayload.authenticationInfo.principalEmail | starts_with | system:serviceaccount:config-management-system: |
protoPayload.authenticationInfo.principalEmail | starts_with | system:serviceaccount:gke-managed-system: |
protoPayload.authenticationInfo.principalEmail | starts_with | system:serviceaccount:gke-system: |
protoPayload.authenticationInfo.principalEmail | starts_with | system:serviceaccount:gmp-public: |
protoPayload.authenticationInfo.principalEmail | starts_with | system:serviceaccount:gmp-system: |
protoPayload.authenticationInfo.principalEmail | starts_with | system:serviceaccount:istio-system: |
protoPayload.authenticationInfo.principalEmail | starts_with | system:serviceaccount:kube-node-lease: |
protoPayload.authenticationInfo.principalEmail | starts_with | system:serviceaccount:kube-public: |
protoPayload.authenticationInfo.principalEmail | starts_with | system:serviceaccount:kube-system: |
protoPayload.authenticationInfo.principalEmail | is_not_null | |
protoPayload.resourceName | is_not_null |
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
protoPayload.methodName | in |
|
protoPayload.request.spec.hostPID | eq |
|
protoPayload.response.spec.hostPID | eq |
|
Output fields
Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.
| Field | Source |
|---|---|
project | resource.labels.project_id |
principal | protoPayload.authenticationInfo.principalEmail |
caller_ip | protoPayload.requestMetadata.callerIP |
methodName | protoPayload.methodName |
resourceName | protoPayload.resourceName |
serviceName | protoPayload.serviceName |