Dev.to Security 🔐 Cybersecurity 👁 2 📖 2 min read

12 Kubernetes & Dockerfile Security Misconfigurations That Slip Past Code Review (Free 100% Local CIS Auditor)

Most container security incidents don't start with exotic kernel zero-days — they start with a copied Deployment YAML that still has allowPrivilegeEscalation left true by default, a Dockerfile running as root with :lates

Most container security incidents don't start with exotic kernel zero-days — they start with a copied Deployment YAML that still has allowPrivilegeEscalation left true by default, a Dockerfile running as root with :latest, or a debug hostNetwork: true flag forgotten before production.

Sending private internal Kubernetes manifests or Dockerfiles to random third-party SaaS scanners during pre-PR checks defeats the whole point of security hygiene. Instead, you can scan manifests 100% locally in your browser (zero server uploads) using the K8s & Docker Security Auditor.

Here are the 12 checks that catch the vast majority of real-world misconfigurations before they hit CI or your cluster.

Part 1: Kubernetes Pod & Container Spec Guardrails

  1. runAsNonRoot: true missing or overridden: Without an explicit non-root securityContext, base images built with USER root run as UID 0 inside the container namespace.
  2. allowPrivilegeEscalation: false omitted: Unless explicitly disabled, Linux setuid binaries inside a compromised container can escalate effective privileges.
  3. readOnlyRootFilesystem: true absent: Makes runtime binary tampering or dropping web shells significantly harder (pair with emptyDir mounts for /tmp).
  4. privileged: true left enabled: Grants near-full host device and kernel capability access — almost never justified outside specialized CNI/CSI DaemonSets.
  5. hostPID: true, hostIPC: true, or hostNetwork: true: Breaks pod-level isolation and exposes host processes or node loopback services.
  6. capabilities.drop: ["ALL"] missing: Drop all Linux capabilities by default and add back only minimal caps (NET_BIND_SERVICE) when required.
  7. Missing resources.requests and resources.limits: Unbounded CPU/memory lets a single leaky pod trigger noisy-neighbor throttling or node OOMKills.
  8. automountServiceAccountToken: false ignored on public workloads: Workloads that don't query the Kubernetes API shouldn't carry a mounted ServiceAccount JWT at /var/run/secrets/kubernetes.io/serviceaccount/token.

Part 2: Dockerfile Hygiene Checks

  1. Floating :latest or unpinned base tags: Breaks deterministic builds and introduces silent supply-chain drift between staging and prod.
  2. No USER instruction before CMD / ENTRYPOINT: Leaves Node/Python/Go runtimes executing as root.
  3. curl | sh or unverified remote installers in RUN layers: Increases image blast radius and bloat when package managers or multi-stage COPY --from suffice.
  4. Plaintext .env or secret-like ENV keys baked into layers: Anyone with docker history or registry pull access can inspect build layers forever.

Free 100% Client-Side DevSecOps & Cloud Toolkit (Zero Telemetry)

All tools below run purely inside your browser (0 backend requests):

Open-source GitOps reference architecture (ArgoCD + Kustomize + Terraform): cloudpulse-gitops-platform.

Also running local AI models privately in Docker? Check hardware sizing on localaihardware.dev — or grab our hardened production packs (20% off with code PH20):

Which check catches the most PRs in your repo (allowPrivilegeEscalation, :latest, or missing limits)?

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.