Skip to content

Structural hash allows collisions #189

@pnowosie

Description

@pnowosie

Issue Type

[x] bug report
[ ] feature request

Current Behavior

We can easily generate 2 transaction with different identifiers (keccak(txbytes)) which both has equal structural hash (EIP-712) which signature schema is using.

At first it seems to be just bug. However as @pdobacz pointed out omgnetwork/elixir-omg#827 (comment) it has more serious security implications.
Including

  • prove non-canonicality of the transaction
  • challenge input piggybacking in IFE which prevents funds exit

Expected Behavior

Transactions with different identifiers MUST HAVE different hashes used in signing

Steps to Reproduce

  1. Create transaction without metadata
  2. Create ☝️ corresponding transaction with metadata = 0 (32-zero bytes)
  3. These transactions differs on identifier and matches on struct hash
  • Full output of error:
  • Command that caused error:
  • Code that caused error:
    Limitation in EIP-712 implementation. 32-zero bytes are used for transaction's metadata when no metadata is contained

Suggested Fix

EIP-712 domain should specify 2 types of transactions

  • with metadata
  • without metadata

Structural hash calculation should identify which type of transaction is provided.

NOTE: We can also make metadata field mandatory

Motivation for Change

Security issue

System Specs

Solidy 0.5
Elixir code changes tracked in elixir-omg#827

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions