Skip to main content

Excessive Privileges - Kubernetes

Description

Kubernetes default configuration is overly permissive, allowing users to escalate privileges or execute commands as privileged users.

Impact

Gain total control over one or more PoDs.

Recommendation

Set strict security policy disabling potentially harmful actions and restricting the user permissions.

Threat

Authenticated attacker with local access to PoD or container.

Expected Remediation Time

⌚ 30 minutes.

Score

Default score using CVSS 3.1. It may change depending on the context of the src.

Base

  • Attack vector: L
  • Attack complexity: L
  • Privileges required: L
  • User interaction: N
  • Scope: U
  • Confidentiality: L
  • Integrity: L
  • Availability: L

Temporal

  • Exploit code maturity: U
  • Remediation level: O
  • Report confidence: C

Result

  • Vector string: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L/E:U/RL:O/RC:C
  • Score:
    • Base: 5.3
    • Temporal: 4.6
  • Severity:
    • Base: Medium
    • Temporal: Medium

Score 4.0

Default score using CVSS 4.0 . It may change depending on the context of the src.

Base 4.0

  • Attack vector: L
  • Attack complexity: L
  • Attack Requirements: N
  • Privileges required: L
  • User interaction: N
  • Confidentiality (VC): L
  • Integrity (VI): L
  • Availability (VA): L
  • Confidentiality (SC): N
  • Integrity (SI): N
  • Availability (SA): N

Threat 4.0

  • Exploit maturity: U

Result 4.0

  • Vector string: CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:U
  • Score:
    • CVSS-BT: 1.1
  • Severity:
    • CVSS-BT: Low

Compliant code

The resource has enabled safe security policies by restricting privileges to authorized users

apiVersion: v1
kind: Pod
metadata:
name: rss-site
labels:
app: web
spec:
privileged: false
containers:
- name: front-end
image: nginx
ports:
- containerPort: 80
securityContext:
capabilities:
add:
- SYS_ADMIN
- NET_ADMIN
- name: rss-reader
image: nickchase/rss-php-nginxv1
ports:
- containerPort: 88
apiVersion: v1
kind: Pod
metadata:
name: rss-site
labels:
app: web
spec:
containers:
- name: front-end
image: nginx
ports:
- containerPort: 80
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
- name: rss-reader
image: nickchase/rss-php-nginxv1
ports:
- containerPort: 88

Non compliant code

The resource does not enable safe security policies allowing privileged execution

apiVersion: v1
kind: Pod
metadata:
name: rss-site
labels:
app: web
spec:
privileged: true
containers:
- name: front-end
image: nginx
ports:
- containerPort: 80
securityContext:
capabilities:
add:
- SYS_ADMIN
- NET_ADMIN
- name: rss-reader
image: nickchase/rss-php-nginxv1
ports:
- containerPort: 88
apiVersion: v1
kind: Pod
metadata:
name: rss-site
labels:
app: web
spec:
containers:
- name: front-end
image: nginx
ports:
- containerPort: 80
securityContext:
allowPrivilegeEscalation: true
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
- name: rss-reader
image: nickchase/rss-php-nginxv1
ports:
- containerPort: 88

Details

https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted https://kubernetes.io/docs/tasks/configure-pod-container/security-context/

Requirements

Fixes

free trial

Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.