Open prestwich opened 1 year ago
thank you @prestwich could this help? https://github.com/LedgerHQ/ledger-live/blob/11e4c3a0279612a8119e66bd4e3ebefcd689e417/libs/ledgerjs/packages/hw-app-eth/src/Eth.ts#L253
We are applying a similar mitigation
Are you saying this is acknowledged and wontfix? Accepting invalid RLP seems like bad behavior in general
ping on this, as people are still discovering this issue in the wild
Description
During tx signing packet exchange, when an APDU packet boundary occurs immediately before the chain-id in an unsigned RLP-serialized EIP155 transaction, the Ledger device completes deserialization of the incomplete RLP bytestring. This prevents the ledger from accepting the last packet, containing the chain ID. The Chain ID is then set to 0 during the user-facing signing flow, because it has not been received by the ledger device. This results in the user accidentally signing valid non-EIP155 transactions, and potential replay on other chains.
This seems to be a misimplementation of RLP within the ledger app on the device, as it completes deserialization and begins the signing flow, despite not receiving a valid RLP bytestring.
Packets sent to the device:
Third pakcet queued, but unsent, as the ledger device entered signing flow and did not send a response:
After sending these packets to the device, the device starts the user signing flow.
Invalid transaction RLP payload the ledger received:
Valid transaction RLP payload that ought to have been received:
Transaction RLP with chunk boundaries inserted:
Notice the 3 bytes missing (!)
Your environment
Steps to reproduce
Issue location:
here, I believe, but I'm not familiar enough with the internals to say definitively
Expected behaviour
Ledger app should deserialize only valid RLP, and wait for additional packets if RLP is invalid
Actual behaviour
Ledger app deserializes invalid RLP
Proposed solution
Change RLP deserializer to prevent successful deserialization of invalid input