Merge remote-tracking branch 'agent/benma-agent/mpu-scratch-nonexecutable'
What changed, and why it matters
This change adjusts how the bootloader configures memory protection for a storage area called 'appdata' on the BitBox02 hardware wallet. The patch appears to extend a protected region so it also covers 'scratch space' and SmartEEPROM, and keeps these areas marked as non-executable. The branch name suggests the intent was to make the scratch area non-executable, which is a hardening measure rather than a fix for an active attack. However, the change is small and the commit message gives no details, so it is difficult to be certain whether this closes a real security gap or is just defensive cleanup.
Treat as a hardening improvement. Review whether the previous MPU layout left scratch space or SmartEEPROM executable or writable in a way that firmware could abuse, and verify the new region size and alignment satisfy the device's MPU requirements without creating overlapping or uncovered gaps. Request a security note or changelog entry from the vendor for confirmation.
Security signals we found
Memory Protection Unit (MPU) region reconfiguration in bootloader
Region marked execute-never (XN) for appdata/scratch/SmartEEPROM
Branch name implies hardening of scratch area against code execution
No explicit bug, CVE, or exploit described in commit or supplied references
Evidence from the diff
In src/bootloader/mpu_regions.c the second MPU region for appdata is redefined. Previously both halves of appdata were configured as two 32 kB read-write/non-execute regions. Now the second region starts at the midpoint of appdata and is sized to cover the full FLASH_APPDATA_LEN, which the new comment says extends coverage to include scratch space and SmartEEPROM. The region remains execute-never. The branch name ‘mpu-scratch-nonexecutable’ implies the goal is to ensure the scratch area cannot be executed. The patch is a four-line change and does not include any test, CVE, or detailed explanation.
Changed components
BitBox02 bootloadersrc/bootloader/mpu_regions.cMPU region configuration for appdata, scratch space, and SmartEEPROMInspect captured patch +4 / −4
### src/bootloader/mpu_regions.c
@@ -49,18 +49,18 @@ static void _set_mpu_regions(void)
mpu_set_region(rbar, rasr);
// Appdata region 0 after firmware app
- // Due to MPU alignment rules, the 64kB area must be split into 2 32kB regions.
+ // Due to MPU alignment rules, appdata cannot be covered by a single 64kB region.
// read-write non-excutable (overlaps flash region but higher priority)
- // End of FLASH_APP to FLASH_USER_END - 8kB
+ // End of FLASH_APP to the midpoint of appdata
rbar = FLASH_APPDATA_START | MPU_REGION_VALID | MPU_REGION_NUMBER_APPDATA_0;
rasr = MPU_REGION_ENABLE | MPU_REGION_TYPE_NORMAL | MPU_REGION_EXECUTE_NEVER |
mpu_region_size(FLASH_APPDATA_LEN / 2) | MPU_REGION_READ_WRITE;
mpu_set_region(rbar, rasr);
- // Appdata region 1 after firmware app
+ // Appdata region 1 extends to the end of flash to include scratch space and SmartEEPROM.
rbar = (FLASH_APPDATA_START + (FLASH_APPDATA_LEN / 2)) | MPU_REGION_VALID |
MPU_REGION_NUMBER_APPDATA_1;
rasr = MPU_REGION_ENABLE | MPU_REGION_TYPE_NORMAL | MPU_REGION_EXECUTE_NEVER |
- mpu_region_size(FLASH_APPDATA_LEN / 2) | MPU_REGION_READ_WRITE;
+ mpu_region_size(FLASH_APPDATA_LEN) | MPU_REGION_READ_WRITE;
mpu_set_region(rbar, rasr);
// Bootdata regionWhy this scored 57/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.