This is an old revision of the document!


Hackathon: GhostTag Apocalypse

Scope

GhostTag Apocalypse is a firmware, security, and BLE simulation challenge. Students implement the protocol of an nRF52840 tag that must be found by authorized gateways without transmitting a stable identifier.

The challenge combines:

  • C code for the protocol;
  • SipHash-2-4 for ephemeral identity and authentication;
  • Zephyr firmware for nrf52840dk/nrf52840;
  • Renode simulation with multiple boards and a positional BLE environment;
  • Automated validation, HTML report, and execution in Kubernetes.

This is a hackathon challenge, not a complete protocol for a real product. It does not fully cover secure provisioning, key protection, replay attacks, radio certification, or a complete privacy evaluation.

Current Status

Status verified on 2026-07-15:

Component Status Remarks
Challenge code Ready Local commit 29a2b3d on branch nrf52840-swarm/ghosttag-apocalypse
Student starter Ready Contains exactly 3 TODOs in firmware/ghost_protocol.c
Reference implementation Ready Located in reference/firmware/; must not be given to students
Native tests Ready SipHash vectors, rotation, tamper, wrong seed, and leakage check
Zephyr build Ready Tag and gateway for nrf52840dk/nrf52840
Renode simulation Ready Tags, gateways, clones, deterministic positions and BLE range
Validator and report Ready Produces validation.json and output/report.html
Platform integration Ready in repository Manifest exists for the scenario and the Showcase Job
Local reference validation Passed Last local evidence: 6/6 tags, 6/6 rotated, 75 rogue packets rejected
Kubernetes cluster Healthy All 3 nodes are Ready, no failed pods, public health 200
Active student scenario No Platform still uses rp2040-sensor-filter-tinyml
GhostTag image in registry Unconfirmed Image must be rebuilt, pushed, and verified before activation
GhostTag showcase Not running Job ghosttag-apocalypse is absent

What Is Already Implemented

Radio Contract

The BLE payload is exactly 28 bytes:

Bytes Content
0..1 Company ID 0xF00D
2 Protocol version 2
3 Flags
4..7 Rotation epoch, little-endian
8..11 Public sector, little-endian
12..19 Authenticated ephemeral identifier
20..27 Authentication tag for bytes 0..19

The packet does not contain the stable ID of the device. The radio identity changes at every epoch, and the gateway verifies the packet using the small authorized key space of the sector.

Student Environment

The student receives in the browser:

  • firmware/ - Editable source;
  • problem/ - Challenge statement;
  • output/ - Logs, results, and HTML report;
  • Run button - Starts the validation pipeline;
  • Results panel - Displays output/report.html.

Data is kept on the user's PVC. A scenario change archives the previous workspace. PVCs must not be deleted during the challenge or at rollback.

Automated Pipeline

Every Run executes, in order:

  1. Native C17 compilation with -Wall -Wextra -Werror;
  2. Known SipHash vectors and tamper tests;
  3. Zephyr build for the tag firmware;
  4. Zephyr build for the trusted gateway;
  5. Renode sector generation;
  6. Starting the nRF52840 machines in the BLE environment;
  7. Collecting UART logs from gateways;
  8. Fleet validation and HTML report generation.

The validator uses only the traffic observed by gateways. It does not read the student's C variables and does not inspect the tags' memory.

Scenario Scale

Mode Tags Gateways Rogue Clones Total Boards
Local smoke 6 3 2 11
Normal student run 12 3 2 17
One showcase sector 16 3 2 21
Complete showcase 192 36 24 252

The showcase uses 12 independent sectors and runs a maximum of 4 in parallel. Each sector has a limit of 3 CPU and 2560 MiB RAM. These values were chosen after real testing; they must not be increased without a new capacity test.

Live Infrastructure

The platform was recovered and hardened after the power incident:

  • CoreDNS is functioning and resolving internal and external names;
  • Cloudflare tunnel uses token from mounted file, not token in arguments;
  • Tunnel credential was rotated;
  • Platform frontend is healthy;
  • Provisioner selects only Ready=True and schedulable workers;
  • All 3 nodes have systemd in running state;
  • The infinite block in plymouth-quit-wait.service was removed;
  • systemd journals are persistent on all nodes.

Platform changes are in commit f5081ea from /home/pwd/eg106-platform on cloud_s1.

What Students Need To Do

Workspace

Students only modify:

firmware/ghost_protocol.c

The header, packet size, CMake, gateway, UART format, epoch duration, or testing harness must not be changed.

TODO 1 - SipHash-2-4

The student implements ghost_siphash24:

  • 128-bit key;
  • 64-bit result;
  • Canonical SipHash-2-4 construction;
  • Little-endian read;
  • Correct support for lengths that are not a multiple of 8;
  • Result identical to the known vectors included in tests.

An approximate implementation or with wrong byte order will not pass.

TODO 2 - Building The Payload

The student completes ghost_build_payload:

  • Keeps the existing header and layout;
  • Derives the ephemeral identity using domain 0x45, the epoch, and the sector;
  • Writes the ephemeral identity in bytes 12..19;
  • Derives the MAC with a different key domain than the one used for EID;
  • Authenticates bytes 0..19;
  • Writes the MAC in bytes 20..27;
  • Does not copy device_seed into the packet.

The same raw key must not be reused directly for both roles.

TODO 3 - Verifying The Payload

The student completes ghost_verify_payload so that it rejects:

  • Wrong company ID;
  • Wrong version;
  • Wrong ephemeral identity;
  • Wrong MAC;
  • Flags modified after signing;
  • Any modification to authenticated bytes;
  • Verification with an unauthorized seed;
  • Clone packets that only respect the protocol format.

The verification must reconstruct the expected values, not accept a packet just because it has the correct size and header.

  1. Read problem/problem.md and the comments for the 3 TODOs;
  2. Implement and verify SipHash first;
  3. Implement EID and MAC;
  4. Implement verification;
  5. Run the challenge using the Run button;
  6. Fix native errors first, then Zephyr errors;
  7. Analyze Renode logs only after builds pass;
  8. Open or refresh the Results panel after the run finishes.

Success Criteria For Students

A solution is accepted only if:

  • All SipHash tests pass;
  • All 3 gateways start;
  • All authorized tags are observed;
  • Each tag changes its radio identity;
  • Clone traffic is rejected;
  • There are no fatal errors in the firmware;
  • The validator displays GHOST_VALIDATION passed=1;
  • The run finishes with GHOSTTAG FLEET SURVIVED THE APOCALYPSE.

Compiling without errors is not enough.

During The Challenge

We monitor:

  • Node and pod health;
  • The Job queue for student runs;
  • Image pull errors;
  • CPU, RAM, and ephemeral storage usage;
  • Frontend and ingress availability;
  • Participants' PVCs;
  • Renode execution times.

We help students with compilation errors, platform usage, and interpreting the report. We do not implement TODOs for them.

Final Showcase

The showcase is optional and separate from student runs.

Before launching:

  • Check requested resources on both workers;
  • Confirm there is at least one healthy worker and enough space for the

approx. 3.76 GB image;

  • Keep parallelism: 4;
  • Do not delete pods or student PVCs to make room.

Launch k8s/showcase/indexed-job.yaml and monitor all 12 completions. The showcase is successful only if all 12 sectors finish successfully and each log contains GHOST_VALIDATION passed=1.

After The Challenge Or At Rollback

  • Only delete the Showcase Job if it needs to be stopped;
  • Restore the saved ConfigMap if reverting to the previous scenario;
  • Do not delete student PVCs;
  • Keep reports and logs useful for evaluation;
  • Check the public health endpoint again;
  • Document any cluster incident or observed capacity limit.

Definition Of Done For Organizers

The challenge can be opened to students when all points are true:

  • [ ] GhostTag image is built from the desired commit;
  • [ ] Reference smoke test passes;
  • [ ] Image tag is confirmed in the registry;
  • [ ] All required nodes are Ready;
  • [ ] Frontend and DNS are healthy;
  • [ ] Manifest dry-run passes;
  • [ ] Previous scenario state is saved;
  • [ ] GhostTag scenario is active;
  • [ ] Starter fails in a controlled manner for the disposable user;
  • [ ] Reference passes for the disposable user;
  • [ ] HTML report loads in Results;
  • [ ] Rollback is prepared;
  • [ ] Reference solution is not accessible to participants.

At the time of writing, the first two remaining operational actions are build/push for the image and controlled activation of the scenario. The showcase must not be launched before the disposable test.

Important Files

File Role
firmware/ghost_protocol.c The only file edited by the student
firmware/include/ghost_protocol.h Wire contract and API
firmware/tests/test_protocol.c Public native tests
ide/problem/problem.md Full statement displayed in the browser
reference/firmware/ Organizers' solution
support/gateway/ Trusted gateway
docker/scripts/build_firmware.sh Native tests and Zephyr builds
docker/scripts/generate_swarm_resc.py Renode topology generation
docker/scripts/validate_swarm.py Automated acceptance criteria
docker/scripts/generate_report.py HTML report
k8s/platform/active-scenario.yaml Scenario activation for students
k8s/showcase/indexed-job.yaml 252-board showcase
docs/HACKATHON_RUNBOOK.md Operational procedure and rollback
docs/instructor_notes.md Recommended structure for the 3-hour session
rasb/lab/hackathon.1784302907.txt.gz ยท Last modified: 2026/07/17 18:41 by jan.vaduva
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0