Writeup · 31 Nights of Root

Centurion Archive

webmediumsolvedFlag: r00t{REDACTED}

Overview

A decades-frozen asset has been reintegrated, and the records system tracking the process is exposed as a thin Flask service behind nginx. The landing page advertises a GraphQL endpoint and three role-scoped namespaces: /field/, /division/ and /director/.

The chain is deliberately linear — each stage hands over the privilege needed by the next:

GraphQL introspection
   -> field token            -> FLAG 1
IDOR on /field/dossier/<id> -> FLAG 2
requestAuditToken + aud-skip -> division token -> FLAG 3
yaml.UnsafeLoader on /division/import -> RCE     -> FLAG 4
SSRF into quartermaster-internal -> HMAC key     -> FLAG 5
TOCTOU race on /approve -> director token        -> FLAG 6

Prerequisites / Setup

export TARGET="<challenge URL or IP>"

curl is sufficient; no wordlist or credentials are required.

Recon

Step 1 — Inspect the application

Goal: Confirm the GraphQL endpoint and role-scoped namespaces.

curl -s "$TARGET/"
{
  "api": "/graphql",
  "namespaces": ["/field/", "/division/", "/director/"],
  "service": "The Centurion Archive"
}

Every namespace without a token leaks its requirement but nothing else.

Vulnerability Analysis

The flaw classes are GraphQL Introspection (information disclosure), IDOR (Improper Access Control), YAML Deserialization (CWE-502), SSRF (Server-Side Request Forgery), and TOCTOU Race Condition.

Exploitation

Step 1 — GraphQL introspection

Goal: Discover the GraphQL schema and available mutations.

curl -s -X POST "$TARGET/graphql" \
  -H "Content-Type: application/json" \
  -d '{"query": "{ __schema { types { name kind fields { name type { name kind } } } } }"}'

Introspection returns a hand-written schema listing three mutations: register, requestFieldAccess, and requestAuditToken. Note that requestAuditToken takes a department argument rather than a password.

Step 2 — Field access token (Stage 1)

Goal: Obtain the field token via GraphQL introspection and IDOR.

Query the GraphQL schema for field definitions, then use IDOR on /field/dossier/<id> to access another user’s dossier and obtain the field token.

Flag

r00t{REDACTED}

Lessons / Takeaways

  • Never expose GraphQL introspection in production without authentication.
  • IDOR on object identifiers allows accessing another user’s resources.
  • yaml.UnsafeLoader allows arbitrary Python object construction and code execution.
  • SSRF into internal services can leak sensitive keys and credentials.
  • TOCTOU races between authorization check and resource use can be exploited for privilege escalation.

Mitigations

  • Disable GraphQL introspection in production or restrict it to authenticated administrators.
  • Implement proper authorization checks on all object access (IDOR prevention).
  • Use yaml.safe_load() instead of yaml.UnsafeLoader.
  • Implement SSRF protection by validating and restricting outbound request targets.
  • Use atomic operations or file locking to prevent TOCTOU races.

Techniques

  • GraphQL Introspection
  • IDOR
  • YAML Deserialization
  • SSRF
  • TOCTOU

References