$ cat writeup.md…
$ cat writeup.md…
Hack.lu 2026
Task: Kubernetes-native challenge tracker where a CRD Challenge references a flag Secret and the UI masks secret data. Solution: the controller merges the live Secret object into a submitted manifest before kubectl apply, which stamps the full data.flag into the unmasked last-applied-configuration annotation, leaked via /debug after port-forwarding to the controller pod.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
Your challenges are so agile that we tracked our Challenges in Kubernetes! The flag is stored in a Kubernetes Secret, and the app just shows you
***.
English summary: The task hands the player a kubeconfig for a service
account (ctf-player) inside a Kubernetes namespace ctf. The namespace runs a
small "challenge tracker" made of three Flask services — ui, api, and
controller — plus the CRD challenges.fluxfingers.ctf/v1 (kind Challenge).
The real flag lives in a Kubernetes Secret under data.flag; every interface
that exposes secrets replaces the values with ***. Goal: read the flag from
the Secret despite the masking.
ui — server-rendered HTML, talks only to api, no ServiceAccount.api — JSON REST wrapper, talks only to controller, no ServiceAccount.controller — the only component with a Kubernetes ServiceAccount
(challenge-controller) and the only one issuing Kubernetes API calls.Player is expected to reach the UI with:
kubectl port-forward -n ctf svc/ui 8080:80
RBAC for the controller (challenge.yaml):
secrets: get, list, create, patch
challenges: get, list, create, update, patch, delete
Player RBAC (user.yaml):
services: get (resourceNames: ["ui"])
pods: get, list
pods/portforward: create, get
Note the last rule: pods/portforward is not restricted with
resourceNames. The player can port-forward to any pod, not just ui.
common.py / controller.py define MASK = "***". mask_secret() replaces
only the data and stringData mappings with *** and returns a deep copy:
def mask_secret(obj): obj = copy.deepcopy(obj) for field in ("data", "stringData"): if isinstance(obj.get(field), dict): obj[field] = {key: MASK for key in obj[field]} return obj
...
$ grep --similar