Lucene search

K
osvGoogleOSV:GHSA-6R4J-4RJC-8VW5
HistoryAug 12, 2024 - 6:22 p.m.

RBAC Roles for `etcd` created by Kamaji are not disjunct

2024-08-1218:22:06
Google
osv.dev
4
rbac
etcd
kamaji
tcp
api server
data security
kubernetes
namespace
access control

CVSS3

9.9

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

LOW

User Interaction

NONE

Scope

CHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

AI Score

6.8

Confidence

Low

EPSS

0.001

Percentile

25.5%

Summary

Using an “open at the top” range definition in RBAC for etcd roles leads to some TCPs API servers being able to read, write and delete the data of other control planes.

Details

The problematic code is this: https://github.com/clastix/kamaji/blob/8cdc6191242f80d120c46b166e2102d27568225a/internal/datastore/etcd.go#L19-L24

The range created by this RBAC setup code looks like this:

etcdctl role get example
Role example
KV Read:
	[/example/, \0)
KV Write:
	[/example/, \0)

The range end \0 means “everything that comes after” in etcd, so potentially all the key prefixes of controlplanes with a name that comes after “example” when sorting lexically (e.g. example1, examplf, all the way to zzzzzzz if you will).

PoC

  1. Create two TCP in the same Namespace
  2. Scale Kamaji to zero to avoid reconciliations
  3. change the Kubernetes API Server --etcd-prefix flag value to point to the other TCP datastore key
  4. wait it for get it up and running
  5. use kubectl and will notice you’re reading and writing data of another Tenant

Impact

Full control over other TCPs data, if you are able to obtain the name of other TCPs that use the same datastore and are able to obtain the user certificates used by your control plane (or you are able to configure the kube-apiserver Deployment, as shown in the PoC).

CVSS3

9.9

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

LOW

User Interaction

NONE

Scope

CHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

AI Score

6.8

Confidence

Low

EPSS

0.001

Percentile

25.5%

Related for OSV:GHSA-6R4J-4RJC-8VW5