Update: Fix signed OTA signature verification bypass when installSignature() called before begin()#12425
Conversation
|
|
…pass Co-authored-by: lucasssvaz <32426024+lucasssvaz@users.noreply.github.com>
installSignature() called before begin()
👋 Hello Copilot, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 94 files 94 suites 28m 32s ⏱️ Results for commit a9a3f70. ♻️ This comment has been updated with latest results. |
_reset()(invoked at the start ofbegin()) was zeroing_signatureSize, silently disabling all hashing and verification even wheninstallSignature()had been called beforehand — the documented usage order. As a result, unsigned or tampered firmware was accepted without error.Change
libraries/Update/src/Updater.cpp: Remove_signatureSize = 0;from_reset()._signatureSizeis user-installed configuration, not runtime state; it must survive the_reset()call insidebegin(). Runtime allocations (_signatureBuffer,_hash) are still freed by_reset()as before.Before: calling
installSignature()→begin()would zero_signatureSize, causing the guards in_writeBuffer()andend()(if (_hash && _signatureSize > 0)) to short-circuit, skipping hashing and verification entirely.After:
_signatureSizepersists acrossbegin(), so verification runs as expected.Original prompt
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.