Fix cerberus high#1026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1026 +/- ##
========================================
Coverage 56.04% 56.04%
========================================
Files 26 26
Lines 2414 2414
Branches 323 323
========================================
Hits 1353 1353
Misses 1057 1057
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
elf sizes
Stack consumption summary (clone_app_stack_consumption)
Stack consumption summary
|
97731de to
9f5f54b
Compare
The home-screen plugin tagline builder accumulated the FORMAT_PLUGIN template length and the caller-controlled caller_app->name length into a uint8_t. A sufficiently long caller name could wrap that accumulator, leading to an undersized allocation for g_tag_line and a subsequent snprintf overflow into adjacent memory across the on-device library-call trust boundary. Bound the plugin name with strnlen() against an explicit maximum and perform the length math in size_t to make the wrap unreachable. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…th 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). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
9f5f54b to
312fb0d
Compare
There was a problem hiding this comment.
It's more of a product nitpick, but for the 7002 / 7251 changes, it seems common practice to include 1 or a few WEIs for theses transactions, which is why the Ragger tests use 1 WEI, and showing it everytime even for these amounts seems overkill :
Both staking plugins set uiType=ETH_UI_TYPE_GENERIC, which suppresses the standard Amount/To pair. The review then displayed only the withdrawal-request amount or validator pubkeys parsed from calldata, never the native tx.value carried by the transaction. A malicious dApp could attach an arbitrary ETH/native amount to a staking-style request and have the user authorize it without seeing the value on screen. Add a "Tx value" review screen to both EIP-7002 and EIP-7251 plugins whenever the transaction's native value is non-zero, and adjust the screen index ? screen kind mapping so the existing validator/amount screens remain in their expected order. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The ERC1155 safeBatchTransferFrom (0x2eb2c2d6) review path explicitly skipped copying token IDs (`// don't copy anything since we won't display it`) and summed every value into a single context->value. The device then only rendered "<total> from <count> NFT IDs", which let a malicious dApp slip a high-value token ID into a batch of innocuous ones without the user being able to detect it on-screen. Capture the first ERC1155_BATCH_DISPLAY_MAX (id, value) pairs into the plugin context, render each pair on its own pair of screens, and add an explicit "WARNING — Only first N of M IDs shown" screen whenever the batch is larger than what we can surface. The aggregate Total Quantity screen is preserved. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
handle_set_plugin() parsed the signed chain_id only to call app_compatible_with_chain_id() and then discarded it. The stored tokenContext kept the plugin name, contract address, and selector but never the chain the registration was signed for. eth_plugin_perform_ init_default() therefore authorized the plugin solely on address + selector match, which let a host preload a valid signed registration for chain A and then route a transaction on chain B through the same plugin UI, masking attacker-controlled calldata behind a familiar review flow. Store the signed chain_id alongside the registration and refuse to activate the plugin when the transaction's chain_id differs. set_external_plugin keeps its chain-unbound semantics (its signed payload contains no chain_id) and is marked explicitly via PLUGIN_CHAIN_ID_ANY; cross-chain protection there requires a protocol change and is left out of scope. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
312fb0d to
b8f41b5
Compare
Ok, fixing by only displaying the information when the value is > 1gwei |
Description
https://ledgerhq.atlassian.net/browse/B2CA-2627
Changes include
Breaking changes
Please complete this section if any breaking changes have been made, otherwise delete it.
Additional comments
Please post additional comments in this section if you have them, otherwise delete it.