-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avoid using uninitialized data from G_io_apdu_buffer #6
base: main
Are you sure you want to change the base?
Conversation
This appears to not be true on the S, but on the ledger X, if I send a new transaction to be signed over bluetooth, but the current transaction has not been approved/denied yet, then the tx approval flow starts over. In that situation, I think we'd fail to clear the buffer. |
src/main.c
Outdated
@@ -40,9 +40,23 @@ struct txn current_txn; | |||
static uint8_t msgpack_buf[1024]; | |||
static unsigned int msgpack_next_off; | |||
|
|||
/* The SDK exposes no information about the length of the received |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
io_exchange
appears to return a length, but it's unclear to me if an attacker can make it seem artifically large.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a worthwhile change, though it doesn't quite capture all of the ways that old G_io_apdu_buffer
data can end up being displayed on the screen.
Looking at this a bit more, it looks like there is |
That sounds reasonable! If there is a reliable source of received length then this becomes easy. |
this way, "make" is "make all"
92d0c8e
to
04ed665
Compare
i think this is purely a pedantic change (our actual invocations of copy_and_advance could never trigger UB), but might as well use the UB-free code pattern.
2bf2dfb
to
08ed394
Compare
Can you check if this code works on the fancy new bluetooth Ledger hardware? (Actually, I'll be in the office later today -- do you have any extras of the new Ledger devices?) |
Hm, just tested this over BLE. It appears to work when the short transaction is sent first, however if I first send a normal payment msgpack payload, approve, and subsequently send a too-short |
No description provided.