Skip to content

Fenrir fixes#790

Merged
danielinux merged 10 commits into
wolfSSL:masterfrom
mattia-moffa:20260529-fenrir-fixes
Jun 9, 2026
Merged

Fenrir fixes#790
danielinux merged 10 commits into
wolfSSL:masterfrom
mattia-moffa:20260529-fenrir-fixes

Conversation

@mattia-moffa

Copy link
Copy Markdown
Member

Fixes F#4257, F#4259, F#4332-4336, F#4709, F#5128, F#5345-5347, F#5350

Fixes F#4259

cmse_nonsecure_entry doesn't intrinsically validate NS-supplied
pointers, so the veneers let a hostile NS caller aim them into Secure
SRAM and make wolfPKCS11 read/write secure memory. Validate every NS
pointer with cmse_check_address_range() (recursing into nested pointers)
and pass wolfPKCS11 only secure copies, so it never dereferences NS
memory -- deep and TOCTOU-safe. Also stop leaking the secure function
table via C_GetFunctionList.
@mattia-moffa mattia-moffa self-assigned this Jun 8, 2026
Copilot AI review requested due to automatic review settings June 8, 2026 15:07
@mattia-moffa mattia-moffa changed the title 20260529 fenrir fixes Fenrir fixes Jun 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR appears to address a batch of “Fenrir” issues by hardening TrustZone-M non-secure-callable boundaries (pointer/range validation and overflow-safe bounds checks), tightening update/flash boundary checks, fixing a flash write bug, and expanding unit-test coverage around update verification failure paths.

Changes:

  • Add extensive TrustZone-M NSC pointer sanitization for PKCS#11 callable veneers (deep-copying mechanisms/templates, length snapshotting to avoid TOCTOU).
  • Add overflow-safe bounds checks and non-secure address validation for NSC update write/erase and PSA IPC vector handling.
  • Fix XSPI flash write pointer increment bug and add/update unit tests for integrity/signature rejection in update-disk flow.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/unit-tests/unit-update-disk.c Adds integrity/signature failure tests; updates verify stubs to set status bits on success.
src/pkcs11_callable.c Implements NSC pointer validation and deep-copy/bounce-buffer logic for PKCS#11 calls.
src/libwolfboot.c Adds overflow-safe partition bounds checks and validates NS buffer pointers for NSC update writes.
src/elf.c Adds overflow-safe range validation for ELF segment destination address calculations.
src/arm_tee_psa_ipc.c Adds NS pointer/range checks for PSA IPC vectors before dispatch.
hal/nxp_ls1028a.c Fixes XSPI flash write buffer pointer arithmetic; minor loop/local variable adjustments.
hal/mpfs250.c Reworks partition boundary checks to avoid overflow in UART QSPI programmer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pkcs11_callable.c
Comment thread src/arm_tee_psa_ipc.c Outdated
Comment thread src/arm_tee_psa_ipc.c Outdated
Comment thread src/arm_tee_psa_ipc.c
@mattia-moffa mattia-moffa force-pushed the 20260529-fenrir-fixes branch from a34e2d7 to 5042e46 Compare June 8, 2026 15:18
@danielinux danielinux merged commit 9a68ef1 into wolfSSL:master Jun 9, 2026
382 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants