fix(core): disable writing MCU attestation certificate in firmware
What changed, and why it matters
This commit changes a Trezor firmware function so that, outside of a special factory testing mode (PRODTEST), it refuses to write an MCU attestation certificate. Previously the function accepted and stored such a certificate. The change prevents firmware from installing or overwriting this certificate, likely to reduce attack surface, but the commit message gives no details about any specific security issue.
Treat as a defense-in-depth hardening change. Review whether the read path and any callers of secret_mcu_device_cert_write handle the new secfalse return value safely. Confirm that production firmware never legitimately needs to write this certificate after manufacturing. Consider adding a changelog or advisory if this change addresses a reported concern.
Security signals we found
Function that writes security-relevant attestation material now returns failure outside factory-test builds
Change is in the secret/secure-storage subsystem
No changelog entry and minimal commit message, suggesting quiet hardening rather than documented bug fix
Read path not modified, so existing certificates remain accessible
Evidence from the diff
The patch wraps secret_mcu_device_cert_write() in core/embed/sec/secret/unix/secret.c with #ifdef TREZOR_PRODTEST. In non-production-test builds it now ignores the certificate pointer/size and returns secfalse. The read path (secret_mcu_device_cert_size and secret_mcu_device_cert_read) is left unchanged. This is a hardening measure that stops firmware from persisting an MCU device attestation certificate; the certificate can still be read if already present.
Changed components
core/embed/sec/secret/unix/secret.csecret_mcu_device_cert_write()MCU attestation certificate storage on Unix emulator/reference buildsInspect captured patch +6 / −0
diff --git a/core/embed/sec/secret/unix/secret.c b/core/embed/sec/secret/unix/secret.c
index 3aed2a90..99221dac 100644
--- a/core/embed/sec/secret/unix/secret.c
+++ b/core/embed/sec/secret/unix/secret.c
@@ -208,12 +208,18 @@ void secret_bhk_regenerate(void) {}
#endif
secbool secret_mcu_device_cert_write(const uint8_t* cert, size_t cert_size) {
+#ifdef TREZOR_PRODTEST
if (cert_size > MCU_ATTESTATION_MAX_CERT_SIZE) {
return secfalse;
}
memcpy(mcu_device_cert, cert, cert_size);
mcu_device_cert_size = cert_size;
return sectrue;
+#else
+ (void)cert;
+ (void)cert_size;
+ return secfalse;
+#endif
}
secbool secret_mcu_device_cert_size(size_t* cert_size) {
Why this scored 33/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.