2024-10-07 15:09:51 +02:00
|
|
|
include::../common/summary.adoc[]
|
2022-07-12 10:46:23 +02:00
|
|
|
|
|
|
|
Process permissions in privileged containers are essentially the same as root
|
|
|
|
permissions on the host. If these processes are not protected by robust
|
|
|
|
security measures, an attacker who compromises a root process on a Pod's host
|
|
|
|
is likely to gain the ability to pivot within the cluster. +
|
|
|
|
Depending on how resilient the cluster is, attackers can extend their attack to
|
|
|
|
the cluster by compromising the nodes from which the cluster launched the
|
|
|
|
process.
|
|
|
|
|
|
|
|
== Ask Yourself Whether
|
|
|
|
|
|
|
|
* The services of this Pod are accessible to people who are not administrators of the Kubernetes cluster.
|
|
|
|
|
2024-10-07 15:09:51 +02:00
|
|
|
There is a risk if you answered yes to this question.
|
2022-07-12 10:46:23 +02:00
|
|
|
|
2024-10-07 15:09:51 +02:00
|
|
|
include::../common/secure-coding-practices.adoc[]
|
2022-07-12 10:46:23 +02:00
|
|
|
|
|
|
|
== Sensitive Code Example
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
----
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Pod
|
|
|
|
metadata:
|
|
|
|
name: example
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- name: web
|
|
|
|
image: nginx
|
|
|
|
ports:
|
|
|
|
- name: web
|
|
|
|
containerPort: 80
|
|
|
|
protocol: TCP
|
|
|
|
securityContext:
|
|
|
|
privileged: true # Sensitive
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
----
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Pod
|
|
|
|
metadata:
|
|
|
|
name: example
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- name: web
|
|
|
|
image: nginx
|
|
|
|
ports:
|
|
|
|
- name: web
|
|
|
|
containerPort: 80
|
|
|
|
protocol: TCP
|
|
|
|
securityContext:
|
|
|
|
privileged: false
|
|
|
|
----
|
|
|
|
|
2024-10-07 15:09:51 +02:00
|
|
|
include::../common/see.adoc[]
|
2022-07-12 10:46:23 +02:00
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
2024-10-07 15:09:51 +02:00
|
|
|
include::../common/message-highlighting.adoc[]
|
2022-07-12 10:46:23 +02:00
|
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|