SIGN IN SIGN UP

fix: EIP-7702 authorization signing state confusion / hidden BIP32 path swap

The EIP-7702 authorization handler kept no signing state. handle_sign_
eip7702_authorization() accepted a new P1_FIRST_CHUNK at any time and
immediately overwrote tmpCtx.authSigningContext7702.bip32 before the
TLV payload was complete. Because tlv_from_apdu() returns success for
buffered partial payloads, a hostile host could start a second
authorization mid-review, swap the BIP32 path, and have auth_7702_ok_cb
sign the displayed authorization hash with a different derivation path
than the one shown on screen.

Introduce a dedicated APP_STATE_SIGNING_EIP7702 and gate the handler
on it: refuse P1_FIRST_CHUNK unless idle, refuse continuation chunks
without an active session, and clear the state on error or on
approval (auth_7702_cancel_cb already resets via send_status).

(cherry picked from commit f3cfb53ed5c3f0f143f81ba7f475cc499abad382)
C
Charles-Edouard de la Vergne committed
d12a1c982d97ecd93efcd8eaecbdc681cf06efdf
Parent: d235754
Committed by Alexandre Paillier <alexandre.paillier@ledger.fr> on 8/25/2026, 3:03:55 PM