Skip to content
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

BUG: Unnecessary permissions in charts #670

Open
Yseona opened this issue Jun 2, 2024 · 1 comment
Open

BUG: Unnecessary permissions in charts #670

Yseona opened this issue Jun 2, 2024 · 1 comment
Labels
bug Something isn't working v2 This affects only Operator v2

Comments

@Yseona
Copy link

Yseona commented Jun 2, 2024

Description

The bug is that the Deployment piraeus-operator-controller-manager in the charts has too much RBAC permission than it needs. The service account of piraeus-operator-controller-manager is bound to a clusterrole (rbac.yaml#L13) with the following permissions:

  • update verb of the clusterrolebingdings resource (ClusterRole)
  • patch/update verb of clusterroles/nodes resource (ClusterRole)
  • create/patch/update/delete verb of the deployments/daemonsets/services resource (ClusterRole)
  • create/patch/update verb of the pods resource (ClusterRole)
  • list verb of the secrets resource (ClusterRole)

After reading the source code of piraeus-operator, I didn't find any Kubernetes API usages using these permissions. Besides, some of these unused permissions may have potential risks. For example, if malicious users gain control of a Kubernetes node running a piraeus-operator-controller-manager pod, they can use the create deployments permission to create privileged containers with malicious container images, or use the patch nodes permission to modify node specifications so that system-critical components with high privileges will run on the controlled node.

Therefore, these permissions should be rechecked to determine if they are truly unnecessary. If they are, the issue should be fixed by removing the unnecessary permissions or by using methods from some similar CVEs (e.g., CVE-2023-26484, CVE-2023-30840).

To Reproduce

Use helm charts with default values.

@WanzenBug WanzenBug added bug Something isn't working v2 This affects only Operator v2 labels Jun 3, 2024
@WanzenBug
Copy link
Member

You are right, most of them are excessive. We use kubebuilder to generate these RBAC from annotations in the code, and the default is to create cluster-scoped resources there. This can be changed, but is never called out in the relevant documentation.

We will work on reducing these permissions as much as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v2 This affects only Operator v2
Projects
None yet
Development

No branches or pull requests

2 participants