Writeup · Cyberweek Africa 2026 - National CTF (Finals)

Build 000

miscunknownsolvedFlag: FLAG{REDACTED}

Event: Cyberweek Africa 2026 - National CTF (Finals) Category: Supply chain audit (Misc) Points: 500 Flag: `FLAG{REDACTED}

Summary

A municipal emergency relay received an update that passed the build server’s green checks, then began accepting unauthorised handovers. Investigators recovered the uploaded package, a QA reference, several independent source snapshots, competing dependency packages, and signed build receipts.

The goal: audit the software supply chain, identify the contaminated build, reproduce the authorised production artefact byte-for-byte, verify the release evidence against provenance/production_policy.json, and open the sealed disclosure to recover the flag.

Everything is local and simulated. Python 3.9+ standard library is sufficient. No network services or external infrastructure are required.

Solver script: solve.py (at the challenge root). It builds every source × dependency pair, screens all seven receipts against the production policy, and opens the sealed disclosure with the authorised artefact.

Evidence

Receipt screening against provenance/production_policy.json

Policy constraints:

  • status == "APPROVED"
  • channel == "production"
  • scope == "RM-APPROVAL-17"
  • issued_at_utc <= 2026-10-27T14:00:00Z
  • signatures must cover roles {release-authority, independent-witness}
  • signer legacy-prod-1 is revoked (not_accepted_signers)
Record Status Channel Issued Cutoff Signers (roles) Result
CWA-RM-BUILD-009 APPROVED production 13:44 ✅ prod-release-2 (release-authority) ✅ + independent-audit-4 (independent-witness) ✅ AUTHORIZED
CWA-RM-BUILD-000 GREEN qa 12:07 ✅ qa-bot-1 (qa-automation) + independent-audit-4 (independent-witness) ❌ wrong status & channel
CWA-RM-BUILD-001 APPROVED qa 12:10 ✅ qa-bot-1 + independent-audit-4 ❌ wrong channel; no release-authority
CWA-RM-BUILD-003 APPROVED production 11:25 ✅ legacy-prod-1 REVOKED + independent-audit-4 ❌ revoked signer
CWA-RM-BUILD-005 PREVIEW production 13:02 ✅ prod-release-2 + independent-audit-4 ❌ not APPROVED
CWA-RM-BUILD-007 APPROVED partner 12:55 ✅ partner-release-3 (partner-qa) + independent-audit-4 ❌ wrong channel; no release-authority
CWA-RM-BUILD-011 APPROVED production 14:05 ❌ after freeze prod-release-2 + independent-audit-4 ❌ issued after cutoff

Only CWA-RM-BUILD-009 satisfies every policy constraint, with both required signature roles verified via RSA-PKCS#1v1.5-SHA256 against the pinned trust roots.

Byte-for-byte reproduction

The accepted claim CWA-RM-BUILD-009 attests artifact SHA256 4f42d3d0659e83c25b9ee2355c77f0598d0e676e525114b8a29808f0e1f36bd4.

Building all 24 source × dependency pairs with tools/repro_builder.py, that hash reproduces only from:

  • sources/s_31cd.tar × dependencies/v_70aa.whl

The authorised build is the “hardened production branch”:

  • controller.py (POLICY = "production"): requires active AND verified AND audit_chain == required_audit_chain AND route == approved_route. No emergency override.
  • packet.py (“verified supplier origin”): verified only when the signature starts with sig: and is ≥ 20 chars; does not manufacture or replace the audit chain.

The compromised upload

dist/build000_uploaded.pkg hashes to 3b329373cf2431c68c183496597995bb44691e207e970be34bb40598310d7c38, which is claim CWA-RM-BUILD-000 (s_56be.tar × v_3d82.whl). It contains the backdoor:

  • controller.py (“experimental emergency branch”): if request.get("emergency"): return True — authorises unauthenticated emergency handovers.
  • packet.py (“mirror override”): always returns verified: True and replaces the audit chain with expected_chain from the packet itself.

Red herrings

  • v_1b7c.whl contains SAMPLE_FALLBACK = "FLAG{REDACTED}" — a valid-looking flag-shaped string that is only a QA calibration marker, not proof of an authorised release.
  • dist/qa_reference.pkg (= CWA-RM-BUILD-001) carries that same QA marker; its channel is qa, not production.

Opening the sealed disclosure

tools/open_release.py requires:

  1. The byte-identical artifact (reproducible from the original source + dependency archives),
  2. The artifact hash matching exactly one eligible, dual-signed production release claim,
  3. The HMAC authentication tag over the sealed capsule to verify.

Running it against the authorised artefact:

python3 tools/open_release.py \
  --source sources/s_31cd.tar \
  --dependency dependencies/v_70aa.whl \
  --artifact authorized_release.pkg

Output:

Authorized receipt: CWA-RM-BUILD-009
RelayMesh production restore accepted.
Finding: the uploaded green artifact combined an emergency-bypass controller with a mirror-supplied packet parser that overwrote the audit chain.
The only permitted recovery is the independently witnessed, dual-signed production build.
EVIDENCE: no release should be trusted solely because its CI status is GREEN.
FLAG: FLAG{REDACTED}

The HMAC tag check passes (calc_tag == tag), which cryptographically confirms the derived decryption key is correct — no other key produces a valid tag, so the plaintext is authoritative.

Vulnerability Analysis

Flag

`FLAG{REDACTED}

Solver script

solve.py at the challenge root reproduces the solve programmatically:

  1. Screens every receipt against production_policy.json (status, channel, scope, cutoff, dual signature roles, revoked signers).
  2. Builds all 24 source × dependency pairs with repro_builder.build().
  3. Finds the pair whose SHA256 matches the accepted claim CWA-RM-BUILD-009 (s_31cd.tar × v_70aa.whl).
  4. Writes authorized_release.pkg and prints the open_release.py command to open the sealed disclosure.

Run:

python3 solve.py
python3 tools/open_release.py --source sources/s_31cd.tar --dependency dependencies/v_70aa.whl --artifact authorized_release.pkg

Notes

  • The relay, packages, receipts, trust roots, and sealed disclosure are fictional competition material.
  • A green CI indication, matching version labels, or a FLAG-shaped string inside a package are not proof of an authorised release; only the reproducible digest attested by the required signing roles is authoritative.
  • The authenticated capsule is opened only with the original source archive, the original dependency archive, and the byte-identical artefact — knowing a build hash alone is insufficient.