> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/iam/appsec2-k8s-1.md).

# RoleBinding should not allow privilege escalation to a ServiceAccount or Node on other RoleBinding m

## Rule Details

|                        |                             |
| ---------------------- | --------------------------- |
| Cortex AppSec Rule ID  | APPSEC2\_K8S\_1             |
| Category - Subcategory | Kubernetes - Access Control |
| Provider               | OTHER                       |
| Severity               | HIGH                        |
| Framework              | Helm, Kubernetes, Kustomize |

## Impact

In Kubernetes, a RoleBinding is used to grant specific permissions to a user or group of users. These permissions, also known as "roles," determine what actions a user is allowed to perform within a Kubernetes cluster. It is important to ensure that RoleBindings are configured in a way that does not allow privilege escalation. This means that a user with a RoleBinding should not be able to gain access to privileges that they are not explicitly granted through their RoleBinding. Allowing privilege escalation would mean that a user could potentially gain unauthorized access to sensitive information or perform actions that they are not supposed to be able to perform. This could pose a security risk to the cluster, so it is important to prevent privilege escalation in RoleBindings. One way to prevent privilege escalation in RoleBindings is to make sure that they are not granted to ServiceAccounts or Nodes. This is because ServiceAccounts and Nodes are not typically associated with individual users, so granting a RoleBinding to them could potentially allow any user who is able to access the ServiceAccount or Node to gain the privileges granted by the RoleBinding. This could lead to privilege escalation, so it is generally best to avoid granting RoleBindings to ServiceAccounts and Nodes.

## How to Fix

## \[source,go]

{ "apiVersion: v1 kind: RoleBinding metadata: name: restricted-access subjects:

* kind: ServiceAccount name: my-service-account
* kind: Node name: my-node roleRef: kind: ClusterRole name: restricted-access apiGroup: rbac.authorization.k8s.io", }

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/iam/appsec2-k8s-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
