Skip to content

fix(security): on-device TX parsing for TRON, blind-sign warnings for TON/Solana#52

Closed
BitHighlander wants to merge 2 commits intodevelopfrom
fix/audit-findings
Closed

fix(security): on-device TX parsing for TRON, blind-sign warnings for TON/Solana#52
BitHighlander wants to merge 2 commits intodevelopfrom
fix/audit-findings

Conversation

@BitHighlander
Copy link
Owner

Security Audit Findings Addressed

TRON — parse TransferContract from signed payload (CRITICAL)

Previously: device displayed host-supplied to_address/amount then signed unrelated raw_data bytes. A malicious host could show a benign transfer while signing a drain.

Fix: Added minimal protobuf parser (tron_parseTransfer()) that extracts to_address and amount directly from the signed raw_data payload for TransferContract (type 1). Simple TRX transfers now show on-device-verified details. Token/contract TXs get explicit blind-sign warning.

TON — explicit blind-sign warning (HIGH)

TON uses Cell/BoC encoding which cannot be feasibly parsed on an embedded device. Added explicit "Blind Signature" warning text so users understand TX details are host-asserted and unverifiable on-device. (On-device Cell parsing is a future improvement.)

Solana — multi-instruction fix + message signing (HIGH)

  • Only show parsed transfer details when num_instructions == 1 AND instruction is a system transfer. Previously showed parsed details for first instruction even in multi-instruction TXs, hiding potentially malicious subsequent instructions.
  • Multi-instruction and unknown programs now get explicit blind-sign warning.
  • Removed show_display=false bypass for message signing — user confirmation is always required since signed messages can authorize on-chain actions.

Test plan

  • CI green (build + unit tests + python integration)
  • TRON: simple TRX transfer shows verified amount/address from payload
  • TRON: TRC-20 token transfer shows blind-sign warning
  • TON: transfer shows blind-sign warning
  • Solana: single system transfer shows verified details
  • Solana: multi-instruction TX shows blind-sign warning
  • Solana: message signing always prompts (even with show_display=false)

Addresses security audit findings for TRON, TON, and Solana signing:

TRON (CRITICAL fix):
- Add minimal protobuf parser to extract TransferContract fields
  (to_address, amount) directly from the signed raw_data payload
- Simple TRX transfers now show on-device-verified details
- Token/contract TXs fall through to explicit blind-sign warning

TON (blind-sign warning):
- TON Cell/BoC encoding cannot be parsed on-device
- Add explicit "Blind Signature" warning so users know TX details
  are host-asserted and unverifiable

Solana (multi-instruction + message signing):
- Only show parsed transfer details for single-instruction system
  transfers (num_instructions == 1)
- Multi-instruction and unknown programs get blind-sign warning
- Remove show_display=false bypass for message signing — always
  require user confirmation
…ount

TRON: Add pb_count_field() to verify exactly one contract entry in
raw_data before showing parsed transfer details. Multiple contracts
now fall through to blind-sign (prevents hiding malicious contracts
behind a benign first TransferContract).

Solana: Add total_instructions field to SolanaParsedTransaction
(actual count from TX, not capped at 8). Use it for the
single-instruction guard and blind-sign warning display.
@BitHighlander
Copy link
Owner Author

Superseded by #56 (TRON reconstruct-then-sign) and #57 (TON address validation + clear signing). Both PRs include all security fixes from this PR plus full implementations.

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.

1 participant