Escalate from an LFI to a Kubernetes Takeover
Chain a docs-portal path traversal into a Kubernetes supply-chain compromise and recover a payments key vault
Overview
Huge Logistics runs the Kubernetes platform that routes tens of thousands of parcels a day across its sorting hubs and last-mile carriers. During a partner demo the internal documentation portal was exposed temporarily, and it is still answering. You are given nothing but that portal's address and a VPN connection into the network segment it lives on.
From that single foothold you chain a path traversal, a looted kubeconfig, a list-without-get RBAC weakness, Helm release-state Secrets, and a poisoned container image into recovery of the payments team's key-vault wrapping key, without ever holding a permission in the production namespace.
Objectives
Starting from one exposed documentation portal and a VPN connection, recover the wrapping key that the payments team keeps in a Kubernetes Secret in the prod namespace.
Prerequisites
- Basic familiarity with web content discovery and path traversal vulnerabilities
- Working knowledge of kubectl, kubeconfig files and Kubernetes RBAC
- Understanding of how container images, registries and tags work
- Ability to write and build a simple Dockerfile
- Basic Python scripting for decoding data and calling an HTTP API
Learning outcomes
- Discover unlinked endpoints on an internal web application through content discovery
- Exploit a path traversal flaw to read application source and loot a kubeconfig
- Validate looted credentials and recognize stale, rotated decoys before building on them
- Enumerate a service account's permissions and identify a list-without-get RBAC weakness
- Extract Secret data through a LIST request when direct GET access is forbidden
- Decode Helm v3 release-state Secrets to recover install-time values and registry credentials
- Read rendered Helm manifests to plan an attack around a workload's RBAC
- Inspect a production image's runtime contract before replacing it
- Poison a mutable floating image tag with a backdoored image that keeps the service healthy
- Abuse a scheduled pod-recycling job and imagePullPolicy Always to execute the poisoned image
- Exfiltrate a Secret in-cluster through a cross-namespace write primitive when egress is blocked
Real-world context
Kubernetes breaches rarely require a cluster exploit. An attacker lands on a single exposed workload, and from there the compromise is assembled from configuration that each team considered safe in isolation. Helm is a good example. Every install and upgrade writes a Secret containing the full rendered release, including every value passed on the command line, so the credentials an operator supplied at install time live on in the cluster in plaintext for as long as the release history does. RBAC is another. Kubernetes evaluates each verb independently, and a role that grants list on Secrets but withholds get looks restrictive while returning every Secret's data in the list response.
The final stage is a software supply-chain attack. When production tracks a mutable tag with imagePullPolicy Always, whoever can push that tag decides what code production runs the next time a pod starts. Routine automation such as autoscalers, node drains and chaos-engineering jobs then completes the attack without the attacker ever touching the production namespace. This maps to the OWASP Kubernetes Top 10 entry K02 Supply Chain Vulnerabilities and to MITRE ATT&CK techniques T1525 Implant Internal Image and T1195.002 Compromise Software Supply Chain.