fix bug in root-keys that prevents bbram provisionig from happening

this bug highlights a fairly big weakness in the rkyv-based
serialization in that there is no inherent type checking of
the sender to the receiver. In this case, a typo of just one
character lead to a regression which, probably in an earlier
version of rkyv, was not a problem because the ordering of
elements was different. In this case it lead to incorrect behavior,
which upon debugging lead to panics because we were interpreting
the data incorrectly after it was unpacked.

This is probably an issue to be worried about in the longer-term,
and it leaves me with a lingering question of what attack
surface exists through the deserialization mechanism for
attackers who send malformed buffers as messages.
This commit is contained in:
bunnie 2026-02-09 02:17:31 +08:00
parent e511e75857
commit 8a2118b8f6

View file

@ -1626,10 +1626,10 @@ fn main() -> ! {
}
Some(Opcode::UxBbramCheckReturn) => {
let buf = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) };
let console_text = buf.to_original::<gam::modal::TextEntryPayloads, _>().unwrap();
log::info!("got console text:{}", console_text.first().as_str());
if console_text.first().as_str().starts_with("HELPER_OK") {
log::info!("got '{}', moving on", console_text.first().as_str());
let console_text = buf.to_original::<gam::modal::TextEntryPayload, _>().unwrap();
log::info!("got console text:{}", console_text.as_str());
if console_text.as_str().starts_with("HELPER_OK") {
log::info!("got '{}', moving on", console_text.as_str());
// proceed
if keys.is_pcache_update_password_valid() || !keys.is_initialized() {
send_message(