Skip to content

fix: replace wildcard verbs on secrets and RBAC resources#422

Open
mgrzybek wants to merge 2 commits into
mainfrom
fix/c2-c3-rbac-wildcard-verbs
Open

fix: replace wildcard verbs on secrets and RBAC resources#422
mgrzybek wants to merge 2 commits into
mainfrom
fix/c2-c3-rbac-wildcard-verbs

Conversation

@mgrzybek

@mgrzybek mgrzybek commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Finding

  • Wildcard verbs on secrets cluster-wide (chart/templates/clusterrole.yaml:52–57)
  • Wildcard verbs on clusterroles and clusterrolebindings — privilege escalation (chart/templates/clusterrole.yaml:85–93)

Root cause

Both rules used "*" as the verb list in the operator's ClusterRole.

The wildcard grants implicit access to any future special verb on secrets cluster-wide, including across all tenant namespaces (Keycloak admin passwords, OIDC client secrets, TLS certificates).

The wildcard on the RBAC rule implicitly included the escalate and bind verbs. escalate allows modifying any ClusterRole to add permissions beyond what the operator itself holds; bind allows creating ClusterRoleBinding objects referencing roles the operator could not normally bind to (e.g. cluster-admin). A compromised operator pod could exploit these to achieve full cluster takeover.

Changes

  • chart/templates/clusterrole.yaml: replaced "*" on the secrets rule with the explicit verb set the operator actually uses (get, list, watch, create, update, patch, delete)
  • chart/templates/clusterrole.yaml: replaced "*" on the RBAC rule (roles, rolebindings, clusterroles, clusterrolebindings) with the same explicit verb set, removing escalate and bind

Note 1: Full remediation (namespace-scoped Role+RoleBinding per managed namespace) requires operator code changes, because the operator writes secrets into dynamically created realm namespaces that are unknown at Helm install time. That work is tracked separately.

Note 2: clusterroles and clusterrolebindings are kept in the resource list because the Dex Helm chart creates a ClusterRole/ClusterRoleBinding for its Kubernetes storage backend. Removing escalate and bind is sufficient to block the privilege escalation path: without bind, creating a ClusterRoleBinding pointing at a more-privileged role is rejected by the Kubernetes API server's escalation-prevention check.

Merge order

No dependency on other open PRs.

@mgrzybek
mgrzybek requested a review from a team as a code owner June 22, 2026 13:11
@mgrzybek mgrzybek changed the title fix: replace wildcard verbs on secrets and RBAC resources (C2, C3) fix: replace wildcard verbs on secrets and RBAC resources Jun 22, 2026
irt-shpc
irt-shpc previously approved these changes Jun 22, 2026
@mgrzybek
mgrzybek force-pushed the fix/c2-c3-rbac-wildcard-verbs branch from 1d787e7 to c8c0e3a Compare June 29, 2026 14:35
mgrzybek added 2 commits June 29, 2026 16:57
- The secrets ClusterRole rule used a verb wildcard ("*"), granting
  implicit access to any future special verb on secrets cluster-wide.
  Replaced with the explicit set of verbs the operator actually requires
  (get, list, watch, create, update, patch, delete). Full namespace
  scoping (Role+RoleBinding per managed namespace) is a separate
  operator-code change; this PR documents the required verbs precisely.

- The RBAC ClusterRole rule used a verb wildcard on roles,
  rolebindings, clusterroles and clusterrolebindings. This implicitly
  granted the escalate and bind verbs, allowing a compromised operator
  pod to add arbitrary permissions to any ClusterRole or create a
  ClusterRoleBinding pointing at cluster-admin. Replaced with the same
  explicit verb set, removing escalate and bind. The Dex chart's
  ClusterRole only requests permissions the operator already holds, so
  no escalate/bind is needed for Helm installs to succeed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants