RBAC roles with attach permission
This product is not supported for your selected
Datadog site. (
).
이 페이지는 아직 영어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우
언제든지 연락주시기 바랍니다.Id: d45330fd-f58d-45fb-a682-6481477a0f84
Cloud Provider: Kubernetes
Platform: Kubernetes
Severity: Medium
Category: Access Control
Learn More
Description
Roles or ClusterRoles that permit attaching to containers via kubectl attach can be abused by attackers to read process output (stdout, stderr) and send input (stdin) to running processes.
They can also allow a malicious user to attach to a privileged container, resulting in privilege escalation.
For this reason, the pods/attach resource should not be included in production Role or ClusterRole rules. This rule flags Role or ClusterRole documents whose rules include the pods/attach resource (and related verb entries such as create or *). Findings support least-privilege enforcement by identifying and removing attach permissions from cluster roles.
Compliant Code Examples
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: my-namespace
name: allow-attach-neg
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: allow-attach-neg
namespace: my-namespace
subjects:
- kind: User
name: bob
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: allow-attach-neg
apiGroup: ""
Non-Compliant Code Examples
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: my-namespace
name: allow-attach
rules:
- apiGroups: [""]
resources: ["pods", "pods/attach"]
verbs: ["get", "list", "create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: allow-attach
namespace: my-namespace
subjects:
- kind: User
name: bob
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: allow-attach
apiGroup: ""