$ cat writeup.md…
$ cat writeup.md…
Hack.lu 2026
Task: Kubernetes challenge tracker (ui/api/controller + Challenge CRD) reachable only through a services/proxy-scoped RBAC, with an unvalidated template-source fetcher. Solution: SSRF the template host via the CoreDNS pod-DNS wildcard to serve arbitrary YAML, then abuse the controller's live-object merge so kite kubectl apply stamps the flag Secret into last-applied-configuration, leaked by the unmasked debug view.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
First Implementation was broken. Now we hardened the permissions a bit.
English summary: this is part 2 of the Challenge Deployment series. The target is a Kubernetes "challenge tracker" deployed in namespace ctf, composed of three Flask services (ui → api → controller) plus a Challenge custom resource (challenges.fluxfingers.ctf/v1). Part 1 was a classic Kubernetes permission mistake; part 2 restricts the player's RBAC so that the only reachable service is the UI. The goal is to read the flag stored in a Kubernetes Secret.
Access model: the player gets a kubeconfig whose ServiceAccount ctf-player only has:
rules: - apiGroups: [""] resources: ["services/proxy"] verbs: ["get", "create"] resourceNames: ["ui", "http:ui:80"] - apiGroups: [""] resources: ["services"] verbs: ["get"] resourceNames: ["ui"]
So there is no pods get and no pods/portforward. The intended entry point is kubectl proxy:
kubectl proxy --port=8080 # UI is then reachable at: # http://localhost:8080/api/v1/namespaces/ctf/services/http:ui:80/proxy/
services/proxy is scoped by resourceNames, so only ui is reachable — api and controller return 403. Every attack must therefore be expressed through the UI's own routes.
player (kubectl proxy) ──► ui (no SA, port 8080) ──► api (no SA) ──► controller (SA challenge-controller)
└─ kubernetes API (secrets/challenges)
ui renders HTML and forwards to api.api has no cluster access. It owns a TEMPLATES registry of {id, name, host} entries and fetches each template's YAML over HTTP.controller is the only component with Kubernetes credentials (challenge-controller SA). It applies submitted YAML and dumps resources for the debug view.web-templates, misc-templates, …) serve a static /template.yaml for the built-in categories.The UI exposes:
...
$ grep --similar