GHSA-6x34-89p7-95wg: Rancher has downstream cluster privilege escalation through cluster and project role template binding (CRTB/PRTB)
ImpactAn issue was discovered in Rancher versions up to and including 2.5.15 and 2.6.6 where a flaw with authorization logic allows privilege escalation through cluster role template binding (CRTB) and project role template binding (PRTB). This issue does not affect the local cluster, it affects only downstream clusters.The vulnerability can be exploited by any user who has permissions to create/edit cluster role template bindings or project role template bindings (such as `cluster-owner`, `manage cluster members`, `project-owner` and `manage project members`) to gain `owner` permission in another project in the same cluster or in another project on a different downstream cluster.The user must have `kubectl` access in the local cluster to exploit this scenario.This can only be abused to gain `cluster-owner` permission on a different downstream cluster if the user is already `cluster-owner` on at least one downstream cluster.Example of a modified CRTB (note: the `clusterName` points to the cluster ID of the cluster that the privileges will be escalated and `namespace` points to the current cluster ID that the user has permissions):An artifact to flag the exploitation of this issue is that the `namespace` of the CRTB/PRTB will not match the cluster name (`clusterName`) of the CRTB/PRTB. For example, every CRTB in the `c-123xyz` namespace should have a cluster name of `c-123xyz`. If instead, the cluster name is `c-abc567`, for example, this is likely a result of a user exploiting this flaw.For more information about cluster and project roles, please consult Rancher's [documentation](https://rancher.com/docs/rancher/v2.6/en/admin-settings/rbac/cluster-project-roles/).PatchesPatched versions include releases 2.5.16, 2.6.7 and later versions.WorkaroundsLimit access in Rancher to trusted users. There is not a direct mitigation besides upgrading to the patched Rancher versions.**Important:**It is highly advised to check the local and downstream clusters for potential unrecognized CRTBs (`kubectl get clusterroletemplatebindings -A`) and PRTBs (`kubectl get projectroletemplatebindings -A`) assignments.The ability to add other users to projects and clusters is a highly-privileged permission which may result in users being able to operate beyond their explicitly specified RBAC. It is recommended that this permission be granted selectively.The following script can be used as a helper to detect possible deviations of CRTBs and PRTBs that do not match the expected value. Further investigation is required to determine if the flagged objects were maliciously modified or not. The script requires `kubectl` access to the `local` cluster and the `jq` command.For more informationIf you have any questions or comments about this advisory:Reach out to [SUSE Rancher Security team](https://github.com/rancher/rancher/security/policy) for security related inquiries.Open an issue in [Rancher](https://github.com/rancher/rancher/issues/new/choose) repository.Verify our [support matrix](https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/) and [product support lifecycle](https://www.suse.com/lifecycle/).
CVSS v3.1: 9.1