Writeup · Cyberweek Africa 2026 - National CTF (Finals)

The Lost Signal 4: The Mobile Revolution

forensicsmediumsolvedFlag: FLAG{REDACTED}

Overview

The Lost Signal — Chapter 4. A fictional coastal mobile handover archive (Kenya telecoms expansion era) containing a KMR4 packet capture, cell adjacency map, per-station clock offsets, paired TX/RX handover audit events, a session register, and an offline replay console (mobile_console.py).

The goal: identify the authentic retained CR-MVT / COAST-RELAY / DATA session among several candidates, verify its handovers using independently corroborated station observations with per-cell clock-offset correction, reject tampered or incomplete traces, then replay the legitimate route through the console to recover R4 and the Chapter 4 flag.

Everything is local and simulated — no network services, no physical equipment. Python 3.9+ stdlib is sufficient.

Solver script: solve.py (at the challenge root). It parses the PCAP and CSVs, independently identifies the authentic session, verifies clock-corrected TX/RX handover pairs, reconstructs the route, drives mobile_console.py, and extracts R4 and the flag.

R3 (from Chapter 3 — The Switching Room): 8B303FABB0B6 (12 hex characters).

Recon

Evidence files

File Purpose
session_capture.pcap KMR4 UDP packet capture (Ethernet/IPv4/UDP port 46640)
cells.json Cell adjacency map with numeric IDs and neighbour lists
clock_offsets.csv Per-cell clock offset (seconds) applied to local ticks
handover_events.csv Paired TX/RX handover audit observations
session_register.csv Session metadata (campaign, service, status, bearer, origin, destination)
mobile_console.py Offline stateful replay console
frame_probe.py KMR4 packet decoder (CRC16 + HMAC-SHA256 verification)

KMR4 frame format (33 bytes)

Per protocol_notes.txt, the UDP payload is:

Offset Size Field
0 4 ASCII magic KMR4
4 1 Protocol version (= 1)
5 1 Kind (1=START, 2=HANDOVER/MOVE, 3=FINAL_DATA)
6 6 ASCII session identifier
12 1 Zero-based sequence number
13 1 Source cell numeric ID
14 1 Destination cell numeric ID
15 2 Big-endian UTC-relative tick
17 6 Payload bytes
23 2 CRC16/CCITT-FALSE over offsets 0..22
25 8 Truncated HMAC-SHA256 over offsets 0..24, key = raw bytes of R3

Session register — candidate selection

The register lists four sessions. The retained target cohort requires all of:

  • campaign = CR-MVT
  • service = COAST-RELAY
  • status = RETAINED
  • bearer = DATA
  • origin = MSA-01
  • destination = LAM-08
Session Campaign Service Status Bearer Origin Destination Note
M0417 CR-MVT COAST-RELAY RETAINED DATA MSA-01 LAM-08 Authentic
M0421 CR-MVT COAST-RELAY RETAINED DATA MSA-01 LAM-08 Decoy — incomplete handover
T9001 LAB-TEST COAST-RELAY RETAINED DATA MSA-01 LAM-08 Lab-test session, not in cohort
X2190 CR-MVT MAINTENANCE CLOSED VOICE MSA-01 LAM-08 Closed voice-maintenance case

Only M0417 and M0421 match the register criteria. T9001 fails on campaign (LAB-TEST) and X2190 fails on status (CLOSED) and bearer (VOICE).

Exploitation

Step 1 — Authenticate frames with R3

Decode every KMR4 frame from the PCAP and verify CRC16 and truncated HMAC-SHA256 using R3 (8B303FABB0B6, decoded from hex to six raw key bytes). A correct CRC proves frame syntax only; a valid HMAC proves authorised origin but not that a relay actually happened.

M0417 authenticated frames (CRC + HMAC valid):

Seq Kind Src Dst Tick
0 START MSA-01 MSA-01 110
1 MOVE MSA-01 KLF-03 120
2 MOVE KLF-03 GED-05 146
3 MOVE GED-05 LAM-07 181
4 MOVE LAM-07 LAM-08 219
5 DATA LAM-08 LAM-08 255

M0417 also has two forged/incomplete frames that fail CRC or MAC:

  • seq=3, GED-05→LAM-06, tick=191: CRC invalid
  • seq=2, KLF-03→MAL-04, tick=153: HMAC invalid

Step 2 — Verify handovers with clock-corrected TX/RX pairs

Each legitimate handover must have one TX entry at the source station and one RX entry at the destination station, agreeing on session, sequence, endpoints, and receipt code. Station local_tick = common_tick + clock_offset. After correcting offsets, TX is at the packet tick and RX is one second later.

Clock offsets (common_tick = local_tick − offset of the observing cell):

Cell Offset (s)
MSA-01 +3
MSA-02 −4
KLF-03 −2
MAL-04 +1
GED-05 +5
LAM-06 −3
LAM-07 +4
LAM-08 −1

Verified handover events for M0417 (grouped by receipt, one TX + one RX per receipt, clock-corrected):

Seq Route Receipt TX (observer, local_tick → common) RX (observer, local_tick → common)
1 MSA-01 → KLF-03 297CED2E MSA-01, 123 → 120 KLF-03, 119 → 121 (= 120 + 1)
2 KLF-03 → GED-05 E597435B KLF-03, 144 → 146 GED-05, 152 → 147 (= 146 + 1)
3 GED-05 → LAM-07 631F1EF6 GED-05, 186 → 181 LAM-07, 186 → 182 (= 181 + 1)
4 LAM-07 → LAM-08 8956305A LAM-07, 223 → 219 LAM-08, 219 → 220 (= 219 + 1)

All four hops are authorised neighbours per cells.json, giving the route:

MSA-01 → KLF-03 → GED-05 → LAM-07 → LAM-08

Step 3 — Why the alternatives fail

  • M0421: Has a valid-looking relay chain (MSA-01 → MSA-02 → MAL-04 → LAM-06 → LAM-08), but the MAL-04 → LAM-06 handover (seq 3) has a TX entry with no matching RX from LAM-06. That missing independent confirmation rejects it.
  • M0417 via LAM-06 or MAL-04 (decoy branches): The PCAP contains authenticated frames on these branches (e.g., GED-05 → LAM-06 seq 3 fails CRC; LAM-06 → LAM-08 seq 4 has TX but no matching RX). For the KLF-03 → MAL-04 hop (seq 2) the audit pair does line up — TX 153, RX 154, receipt 6CD16F0D — but the console finds no uniquely authenticated, CRC-valid frame for that transition, so the branch is rejected.
  • EV-0023: a LAM-08 RX for LAM-07 → LAM-08 carrying receipt 00000000. It matches no TX entry and is a placeholder or forged record.
  • EV-0007 / EV-0008 (LAM-07 → LAM-08): Look inconsistent as raw local ticks (TX 223, RX 219). Clock offsets correct this: LAM-07 is +4 (223 − 4 = 219) and LAM-08 is −1 (219 − (−1) = 220), so TX = 219 and RX = 220 on the common clock — meeting the “RX one second after TX” rule.
  • T9001: Lab-test session, not in the target cohort.
  • X2190: Closed voice-maintenance case, not in the target cohort.

Step 4 — Replay on the offline console

Drive mobile_console.py with the authenticated session and receipts:

AUTH 8B303FABB0B6
SELECT M0417
START MSA-01
MOVE KLF-03 297CED2E
MOVE GED-05 E597435B
MOVE LAM-07 631F1EF6
MOVE LAM-08 8956305A
COMMIT

The console accepted every move and committed successfully:

FRAME RECOVERED. R4=7EB0D0F95FD3
FLAG{REDACTED}
Retain R4 for Chapter 5.

On COMMIT, the FINAL_DATA payload is decrypted with a six-byte mask: MASK = first 6 bytes of SHA256("LS04-MASK|" + R3 + "|" + SESSION + "|" + RECEIPT1:RECEIPT2:RECEIPT3:RECEIPT4)

Recovered R4 = (FINAL_DATA_PAYLOAD XOR MASK).hex().upper() = 7EB0D0F95FD3.

Flag

`FLAG{REDACTED}

R4 = 7EB0D0F95FD3 — retain for Chapter 5.

Solver script

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

  1. Loads session_register.csv, handover_events.csv, clock_offsets.csv, cells.json, and session_capture.pcap.
  2. Filters sessions by the retained target cohort (CR-MVT / COAST-RELAY / RETAINED / DATA, origin MSA-01, destination LAM-08).
  3. Decodes all KMR4 frames, verifying CRC16 and HMAC-SHA256 with R3.
  4. For each sequence 1–4, pairs TX/RX handover events grouped by receipt code, correcting per-station clock offsets (TX at packet tick; RX at tick + 1).
  5. Walks verified hops in sequence order, checking adjacency, to reconstruct the route MSA-01 → KLF-03 → GED-05 → LAM-07 → LAM-08.
  6. Drives mobile_console.py via stdin (AUTH → SELECT → START → MOVE ×4 → COMMIT → QUIT) and extracts R4 and the flag.

Run:

python3 solve.py

R3 (8B303FABB0B6) is embedded as the default (retained from Chapter 3). It can also be supplied as an argument: python3 solve.py <R3>.

Vulnerability Analysis

Mitigations

  • Require independent two-sided corroboration (TX at source + RX at destination) for every handover event before accepting it as authentic.
  • Authenticate handover events with per-station keys or signatures, not just a session-level HMAC.
  • Validate frame timing against per-station clock offsets before accepting any handover.
  • Treat CRC validity as syntax checking only, never as proof of authenticity.

Lessons / Takeaways

  • CRC validity ≠ authorisation: A frame can be syntactically intact (CRC-valid) but forged or unauthenticated. HMAC is needed for origin authenticity.
  • HMAC validity ≠ relay occurred: An authenticated frame still needs independent observer corroboration (paired TX/RX at both stations).
  • Clock offsets matter: Raw local ticks can look inconsistent (TX 223 vs RX 219) but reconcile perfectly after per-station offset correction (TX 219, RX 220 on the common clock).
  • Filter by receipt before counting: Multiple RX entries may exist for the same tick; grouping by receipt code isolates the genuine two-sided pair from decoys.
  • Register criteria narrow candidates, but evidence confirms: Two sessions match the register; only one has complete two-sided handover evidence.

Techniques

  • PCAP Analysis
  • HMAC Verification
  • Clock Offset Correction
  • Protocol Replay