feat(vendor): zero memory freed by the MicroPython GC
What changed, and why it matters
This commit updates the MicroPython interpreter used in Trezor hardware wallets so that memory freed by the garbage collector is overwritten with zeros. The goal is to reduce the risk that leftover secrets (such as private keys or PIN data) remain in memory after they are no longer needed. It is a defensive hardening change, not a fix for a known exploitable bug.
Treat as a defensive hardening improvement. Review the bumped MicroPython submodule diff to confirm the flags are implemented as expected and do not introduce performance regressions or new bugs. No immediate incident response is warranted absent evidence of an exploitable vulnerability.
Security signals we found
Memory-zeroing hardening for GC-managed heap
Submodule bump to newer MicroPython revision
Flags apply to both firmware and emulator builds
Evidence from the diff
The patch enables two MicroPython configuration flags, MICROPY_GC_CLEAR_ON_SWEEP and MICROPY_GC_CLEAR_ON_FREE, in both the STM32 firmware and Unix emulator builds. These flags cause the garbage collector to zero memory during GC sweeps and when gc_free()/gc_realloc() release blocks. The vendor/micropython submodule is also bumped to a newer commit that presumably implements or supports these flags. The change is purely hardening against information disclosure via stale heap data.
Changed components
core/embed/projects/firmware/src/stm32/mpconfigport.hcore/embed/projects/firmware/src/unix/mpconfigport.hvendor/micropython (submodule)Inspect captured patch +5 / −1
### core/embed/projects/firmware/src/stm32/mpconfigport.h
@@ -68,6 +68,8 @@
// Python internal features
#define MICROPY_READER_VFS (0)
#define MICROPY_ENABLE_GC (1)
+#define MICROPY_GC_CLEAR_ON_SWEEP (1)
+#define MICROPY_GC_CLEAR_ON_FREE (1)
#define MICROPY_ENABLE_FINALISER (1)
#define MICROPY_STACK_CHECK (1)
#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1)
### core/embed/projects/firmware/src/unix/mpconfigport.h
@@ -74,6 +74,8 @@
// Python internal features
#define MICROPY_READER_VFS (1)
#define MICROPY_ENABLE_GC (1)
+#define MICROPY_GC_CLEAR_ON_SWEEP (1)
+#define MICROPY_GC_CLEAR_ON_FREE (1)
#define MICROPY_ENABLE_FINALISER (1)
#define MICROPY_STACK_CHECK (1)
#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1)
### vendor/micropython
@@ -1 +1 @@
-Subproject commit 7184eb6d51e0f458c5bc381299eea109f3713a7e
+Subproject commit 1578ef25bed237bdb0ebabb6647cf3535b257b89Why this scored 45/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.