Background
The OTA download path streams the firmware binary directly into Update.write() without any integrity check before committing. A MITM on the shared network can replace the .bin during download and the device will flash the attacker-controlled binary.
Required Changes
- SHA-256 hash verification: Compute hash of downloaded stream and compare against expected hash from GitHub release metadata
- Ed25519 signature verification (long-term): Verify binary signature using compiled-in public key
- Graceful failure: On verification failure, abort update, keep UI state for retry
Affected Files
src/OtaUpdater.cpp — downloadAndApply(), fetchLatestRelease()
src/OtaUpdater.hpp — New constants and helpers
scripts/sign-release.sh — New signing script (phase 2)
.github/workflows/release.yml — Add signing step (phase 2)
OpenSpec
Full specification: openspec/specs/ota-binary-verification.spec.md
Change marker: openspec/changes/p1-ota-binary-verification/
Related
Background
The OTA download path streams the firmware binary directly into
Update.write()without any integrity check before committing. A MITM on the shared network can replace the.binduring download and the device will flash the attacker-controlled binary.Required Changes
Affected Files
src/OtaUpdater.cpp—downloadAndApply(),fetchLatestRelease()src/OtaUpdater.hpp— New constants and helpersscripts/sign-release.sh— New signing script (phase 2).github/workflows/release.yml— Add signing step (phase 2)OpenSpec
Full specification:
openspec/specs/ota-binary-verification.spec.mdChange marker:
openspec/changes/p1-ota-binary-verification/Related