k8s-liveness-probe-not-configured: Liveness Probe Not Configured in Deployments

2025-08-01 k8s PoC Public

Description

Checks for missing liveness probes in Kubernetes Deployments, which are essential for managing container health and automatic recovery

Details

Severity
中危
Affected
k8s
Published
PoC
Public

PoC

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: true
code:
  - 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:922c64590222798bb761d5b6d8e72950

# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.

References

Related Vulnerabilities

微信搜一搜 biu.life