Skip to content
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

Accidental information revealed with an odd number of records and unhashed leaves #61

Open
amidmm opened this issue Aug 8, 2022 · 0 comments

Comments

@amidmm
Copy link

amidmm commented Aug 8, 2022

In the case the tree is configured without hashing the leaves an odd number of records, there is a chance of unwanted information leakage through providing the proof.

Example

input:

  [
    "0x10",
    "0x20",
    "0x30",
    "0x40",
    "0x50"
  ]

The tree would be formed like the following:

└─ 5493d426be69128c5b6519e81d40789fdf00315e201f89f3145fe2fd790cf016
   ├─ 50
   │  └─ 50
   │     └─ 50
   └─ 52e9510c9a9b4b27dc47dcebf0bd2e6e728afeb986cbb84cde1adb1cc245342d
      ├─ 3c274a8322731c85c4d7f7d35a8b13cbab3a57a14170cce898055f9744e66124
      │  ├─ 10
      │  └─ 20
      └─ b6b0b94b1eeca3d159f819eb437760159b7bac423d25f7b21201130423635e99
         ├─ 30
         └─ 40

Will providing proof for any leaf would result in revealing 0x50.
Proof for 0x10:

[
  "0x20",
  "0xb6b0b94b1eeca3d159f819eb437760159b7bac423d25f7b21201130423635e99",
  "0x50"
]

Possible solution

Hash the odds by default instead of duplicating the odds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants