-
Notifications
You must be signed in to change notification settings - Fork 68
/
default-rules.yaml
448 lines (417 loc) · 25.2 KB
/
default-rules.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
Name: InsightCloudSec
Description: Rapid7 InsightCloudSec default RBAC analysis rules
Uuid: 9371719c-1031-468c-91ed-576fdc9e9f59
# Exclusion expressions are evaluated with subject objects as an input
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
GlobalExclusions:
- AddedBy: InsightCloudSec@rapid7.com
Comment: "Exclude kube-system from analysis"
Disabled: false
Expression: |
has(subject.namespace) && (subject.namespace == "kube-system")
LastModified: "2021-09-22T15:25:01+03:00"
- AddedBy: InsightCloudSec@rapid7.com
Comment: "Exclude system roles from analysis"
Disabled: false
Expression: |
has(subject.name) && subject.name.startsWith('system:')
LastModified: "2021-09-22T15:25:01+03:00"
- AddedBy: InsightCloudSec@rapid7.com
Comment: "Exclude gatekeeper-system/gatekeeper-admin from analysis"
Disabled: false
Expression: |
has(subject.namespace) && (subject.namespace == "gatekeeper-system") &&
has(subject.name) && (subject.name == "gatekeeper-admin")
LastModified: "2021-09-22T15:25:01+03:00"
ValidBefore: 0
# Analysis Rules
Rules:
- Name: Secret Readers
Description: Capture principals that can read secrets
References: []
Severity: HIGH
Uuid: 3c942117-f4ff-423a-83d4-f7d6b75a6b78
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating resources - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['get', '*']) && (has(rule.resource)
&& rule.resource in ['secrets', '*']) && (has(rule.apiGroup)
&& rule.apiGroup in ['core', '*'])
)
)
Exclusions:
- AddedBy: InsightCloudSec@rapid7.com
Comment: "Exclude kube-system from analysis"
Disabled: true
Expression: |
has(subject.namespace) && (subject.namespace == "kube-system")
LastModified: "2021-09-22T15:25:01+03:00"
ValidBefore: 0
- Name: Workload Creators & Editors
Description: Capture principals that can create or modify workloads of any kind (Deployments, Jobs, ...)
Severity: HIGH
Uuid: d5f5ea0c-82e9-4289-ba04-b40cc46be017
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://certitude.consulting/blog/en/kubernetes-rbac-security-pitfalls/
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb)
&& rule.verb in ['create', 'update', 'patch', '*']) &&(has(rule.resource)
&& rule.resource in ['deployments', 'replicationcontrollers','daemonsets', 'statefulsets', 'replicasets', 'pods', 'jobs','cronjobs', '*'])
&& (has(rule.apiGroup) && rule.apiGroup in ['core', 'batch','*'])
)
)
Exclusions: []
- Name: Identify Privileges Escalators - via impersonate
Description: Capture principals that can escalate privileges through the use of impersonation
Severity: CRITICAL
Uuid: a845ec84-8fec-4d64-8d8b-7c2b9ca05d63
References:
- https://certitude.consulting/blog/en/kubernetes-rbac-security-pitfalls/
- https://kubernetes.io/docs/reference/access-authn-authz/rbac/
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb)
&& rule.verb in ['impersonate', '*']) &&(has(rule.resource)
&& rule.resource in ['users','groups','serviceaccounts', '*']) && (has(rule.apiGroup)
&& rule.apiGroup in ['core', '*'])
)
)
Exclusions: []
- Name: Identify Privileges Escalators - via bind or escalate
Description: |
Capture principals that can escalate privileges through the use of special API verbs 'bind' or 'escalate',
or those that can manipulate resources that govern permissions (ClusterRoles and Roles)
Severity: CRITICAL
Uuid: 022bc6ea-83e2-4dae-9074-b306b38dc58d
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'" +
"\nYou can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://certitude.consulting/blog/en/kubernetes-rbac-security-pitfalls/
- https://kubernetes.io/docs/reference/access-authn-authz/rbac/
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['bind', 'create', 'update', 'patch', 'escalate', '*']) &&
(has(rule.resource) && rule.resource in ['clusterroles', 'roles', '*']) &&
(has(rule.apiGroup) && rule.apiGroup in ['rbac.authorization.k8s.io','*'])
)
)
Exclusions: []
- Name: Storage & Data - Manipulate Cluster Shared Resources
Description: Capture principals that can manipulate shared cluster storage resources such as StorageClass, Volumes, VolumeClaims
Severity: HIGH
Uuid: e43fe915-ca58-481d-821b-5481b1d0df02
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://kubernetes.io/docs/concepts/storage/
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['create', 'delete', 'update', 'patch', '*']) &&
(
(
has(rule.resource) && rule.resource in ['persistentvolumeclaims', 'persistentvolumes', '*'] &&
has(rule.apiGroup) && rule.apiGroup in ['core','*']
) ||
(
has(rule.apiGroup) && rule.apiGroup in ['storage.k8s.io','*']
)
)
)
)
Exclusions: []
- Name: Networking - Manipulate Networking and Network Access related resources
Description: |
Capture principals that can manipulate shared cluster networking services such as
Services, Ingresses, NetworkPolicies, Endpoints and EndpointSlices.
Severity: HIGH
Uuid: 24392e04-77dd-4721-8aa8-6fc8f6f7005c
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://kubernetes.io/docs/concepts/services-networking/
- https://kubernetes.io/docs/concepts/services-networking/ingress/
- https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/
- https://kubernetes.io/docs/concepts/services-networking/network-policies/
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['create', 'delete', 'update', 'patch', '*']) &&
(
(
has(rule.resource) && rule.resource in ['networkpolicies', 'ingresses', 'ingressclasses','*'] &&
has(rule.apiGroup) && rule.apiGroup in ['networking.k8s.io', 'extensions', '*']
) ||
(
has(rule.resource) && rule.resource in ['services', 'endpoints', '*'] &&
has(rule.apiGroup) && rule.apiGroup in ['core','*']
) ||
(
has(rule.resource) && rule.resource in ['endpointslices', '*'] &&
has(rule.apiGroup) && rule.apiGroup in ['discovery.k8s.io','*']
)
)
)
)
Exclusions: []
- Name: Networking - Manipulate Gateway API Resources
Description: |
Capture principals that can manipulate shared cluster networking services such as
Gateway Classes, Gateways, HTTPRoutes, TLSRoutes, etc,.
Severity: HIGH
Uuid: 337c205f-7479-4a31-9057-03c6c8d2f80e
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://gateway-api.sigs.k8s.io/
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['create', 'delete', 'update', 'patch', '*']) &&
(has(rule.resource) && rule.resource in ['gatewayclasses', 'gateways', 'httproutes', 'tcproutes', 'tlsroutes', 'udproutes', '*']) &&
(has(rule.apiGroup) && rule.apiGroup in ['gateway.networking.k8s.io', '*']) )
)
Exclusions: []
- Name: Installing or Modifying Admission Controllers
Description: Capture principals that can install/update Kubernetes admission controllers of any kind
Severity: CRITICAL
Uuid: e08e762e-50d6-4091-a37a-c4dd01d274a9
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/
- https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/
- https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['create', 'update', 'patch', '*']) &&
(
has(rule.resource) && rule.resource in ['mutatingwebhookconfigurations', 'validatingwebhookconfigurations', '*'] &&
has(rule.apiGroup) && rule.apiGroup in ['admissionregistration.k8s.io','*']
)
)
)
Exclusions: []
- Name: Installing or Modifying Cluster Extensions (CRDs)
Description: Capture principals that can install/delete/update Kubernetes Custom Resources
Severity: MEDIUM
Uuid: 773d2782-8d26-4aea-b6dc-719b9072729a
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['create', 'update', 'patch', 'delete', '*']) &&
(
has(rule.resource) && rule.resource in ['customresourcedefinitions', '*'] &&
has(rule.apiGroup) && rule.apiGroup in ['apiextensions.k8s.io','*']
)
)
)
Exclusions: []
- Name: Open Policy Agent (OPA) GateKeeper Administration
Description: Capture principals that have administrative privileges and can manage OPA GateKeeper shared resources resources
Severity: HIGH
Uuid: 9d3d62c2-81a5-439a-bc51-9b74f8124822
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://open-policy-agent.github.io/gatekeeper/website/docs/constrainttemplates
- https://open-policy-agent.github.io/gatekeeper/website/docs/mutation
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['create', 'update', 'patch', 'delete', '*']) &&
(
has(rule.resource) && rule.resource in ['constrainttemplates', '*'] &&
has(rule.apiGroup) && rule.apiGroup in ['templates.gatekeeper.sh','*']
) ||
(
has(rule.resource) && rule.resource in ['assign', 'assignmetadata', '*'] &&
has(rule.apiGroup) && rule.apiGroup in ['mutations.gatekeeper.sh','*']
) ||
(
has(rule.resource) && rule.resource in ['configs', '*'] &&
has(rule.apiGroup) && rule.apiGroup in ['config.gatekeeper.sh','*']
)
)
)
Exclusions: [] # gatekeeper-system/gatekeeper-admin excluded in global exceptions
- Name: Create Node Proxy
Description: Capture principals with permissions to create node proxies, which provides direct access to Kubelet APIs and can be used for privileges escalation.
Severity: CRITICAL
Uuid: EB43D06A-8534-43EB-8360-117D0AB06808
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://blog.aquasec.com/privilege-escalation-kubernetes-rbac
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['create', '*']) &&
(has(rule.resource) && rule.resource in ['nodes/proxy', '*']) &&
(has(rule.apiGroup) && rule.apiGroup in ['', '*']) )
)
Exclusions: [] #
- Name: Create Ephemeral Containers in Running Pods
Description: |
Capture principals with permissions to create ephemeral containers in running Pods.
Permissions to create ephemeral container provides the ability to execute code in other pods as well as executing code with excessive process permissions (by setting securityContext field) which can potentially lead to container escape to the hosting node.
Severity: HIGH
Uuid: D43B8BDC-B0D3-4FFA-B320-95F516B514B3
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://kubernetes.io/docs/concepts/workloads/pods/ephemeral-containers/
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['patch', 'update', '*']) &&
(has(rule.resource) && rule.resource in ['pods/ephemeralcontainers', '*']) &&
(has(rule.apiGroup) && rule.apiGroup in ['', '*']) )
)
Exclusions: []
- Name: Exec into Pod
Description: |
Capture principals with permissions to exec into running Pods.
Principals with such permissions can execute code in privileged pods, or execute code in pod running in privileged namespace, are likely to yield additional privileges escalation.
Severity: HIGH
Uuid: 9755128A-C1B4-410B-B163-09165E9F14EF
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['create', '*']) &&
(has(rule.resource) && rule.resource in ['pods/exec', '*']) &&
(has(rule.apiGroup) && rule.apiGroup in ['', '*']) )
)
Exclusions: []
- Name: Kyverno Administration
Description: Capture principals that have administrative privileges and can manage Kyverno shared resources resources
Severity: HIGH
Uuid: 7f9a4ef2-535b-4e44-897c-90a94ae9c985
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://kyverno.io/docs/
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['create', 'update', 'patch', 'delete', '*']) &&
(
has(rule.resource) && rule.resource in ['clusterpolicies', 'policies', '*'] &&
has(rule.apiGroup) && rule.apiGroup in ['kyverno.io','*']
)
)
)
Exclusions: []
- Name: Installing or Modifying Kubernetes Admission Policies
Description: Capture principals that can install/update Kubernetes Admission Policies of any kind
Severity: HIGH
Uuid: e3fbfb0f-2f3b-4c30-ada4-50bbe73f421e
Recommendation: |
"Review the policy rules for \'" + (has(subject.namespace) ? subject.namespace +"/" : "") + subject.name + "\' ("+ subject.kind +") by running \'rbac-tool policy-rules -e " + subject.name +"\'.\n" +
"You can visualize the RBAC policy by running \'rbac-tool viz --include-subjects=" + subject.name +"\'"
References:
- https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/
# Analysis expressions are evaluated with array of SubjectPermissions object - see https://github.com/alcideio/rbac-tool/blob/master/pkg/rbac/subject_permissions.go#L11
# Expression syntax can be found here: https://github.com/google/cel-spec/blob/master/doc/intro.md
# In the expression when evaluating rule.resource - use plural form (secrets not secret)
AnalysisExpr: |
subjects.filter(
subject, has(subject.allowedTo) && subject.allowedTo.exists(
rule,
(has(rule.verb) && rule.verb in ['create', 'update', 'patch', '*']) &&
(
has(rule.resource) && rule.resource in ['validatingadmissionpolicies', 'validatingadmissionpolicybindings', '*'] &&
has(rule.apiGroup) && rule.apiGroup in ['admissionregistration.k8s.io','*']
)
)
)
Exclusions: []