Liveness Probe Not Configured in Deployments
ID: k8s-liveness-probe-not-configured
Severity: medium
Author: princechaddha
Tags: cloud,devops,kubernetes,k8s,devsecops,deployments,k8s-cluster-security
Description
Section titled “Description”Checks for missing liveness probes in Kubernetes Deployments, which are essential for managing container health and automatic recovery
YAML Source
Section titled “YAML Source”id: k8s-liveness-probe-not-configured
info: name: Liveness Probe Not Configured in Deployments author: princechaddha severity: medium description: Checks for missing liveness probes in Kubernetes Deployments, which are essential for managing container health and automatic recovery impact: | Absence of liveness probes can lead to unresponsive containers remaining in service, potentially degrading application performance and availability. remediation: Configure liveness probes for all containers in Kubernetes Deployments to ensure proper health checks and automatic restarts of failing containers reference: - https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ tags: cloud,devops,kubernetes,k8s,devsecops,deployments,k8s-cluster-security
flow: | code(1); for (let deployment of template.items) { set("deployment",deployment) javascript(1); }
self-contained: truecode: - engine: - sh - bash source: kubectl get deployments --all-namespaces --output=json extractors: - type: json name: items internal: true json: - '.items[]'
javascript: - code: | deployment = JSON.parse(template.deployment); if (!deployment.spec.template.spec.containers.some(container => container.livenessProbe)) { let result = (`Deployment '${deployment.metadata.name}' in namespace '${deployment.metadata.namespace}' lacks a configured liveness probe.`); Export(result); }
extractors: - type: dsl dsl: - response# digest: 4b0a00483046022100e2c6ab8810c08dce9356f0c3916aa1f7700aa54c41567271f6842ffc361a88b30221008d909d1eb145ab1e69dafd980061b781bba8bc4fe3edbb0283cbac9e1bee4042:922c64590222798bb761d5b6d8e72950Guide to check the vulnerabilities
Section titled “Guide to check the vulnerabilities”This template is used to detect vulnerabilities in web applications. It can be used with the Nuclei tool to scan for specific patterns or behaviors.
$ nuclei -u "URL" -t "cloud/kubernetes/deployments/k8s-liveness-probe-not-configured.yaml"