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

Address private set intersection exploit #318

Open
sgwilym opened this issue Mar 21, 2023 · 2 comments
Open

Address private set intersection exploit #318

sgwilym opened this issue Mar 21, 2023 · 2 comments

Comments

@sgwilym
Copy link
Contributor

sgwilym commented Mar 21, 2023

What's the problem you want solved?

When two peer sync, they send each other a DISCLOSE message:

/** An event for disclosing which shares a Peer has without actually revealing them. Another peer can use the salt to hash their own shares' addresses and see if they match. */
export type SyncerDiscloseEvent = {
  kind: "DISCLOSE";
  syncerId: string;
  salt: string;
  shares: string[];
  formats: string[];
  canRespond: boolean;
};

While this does not reveal the share addresses, it seems like there's a way for a malicious peer to trick a peer into thinking they both have the same shares: simply mirroring the honest peer's disclose message back at them.

The honest peer would then assume the other peer has all the same shares in common, and would proceed to send sync messages potentially containing share addresses to the malicious peer.

This problem domain is called private set intersection.

Is there a solution you'd like to recommend?

  • We could make it so that if a peer receives a DISCLOSE message with the same salt as it sent itself, it'd be enough reason to suspect funny business and disconnect.
    • But a malicious peer could simply harvest some hashes + salts from failed attempts, and then send them back on subsequent sync attempts, getting around the check and tricking the honest peer into sending sync messages.
  • Peers could start sync by sending each other the salt they have to use when hashing their shares. Then the probability of the other peer having a hash using that specific salt is very low.
    • The malicious peer could wait for the other side's salt, and just send it back.
  • We could use public key encryption. Alice and Bob send each other public keys (generated just for this sync session) for encrypting with. Alice and Bob generate a salt, encrypt that salt with the other's public key, and send it to each other. Each side expects the other to send a list of their shares hashed with the salt they provided.
@sgwilym
Copy link
Contributor Author

sgwilym commented Mar 21, 2023

Additionally, we should probably not have share addresses in sync messages. Rather we should refer to the shares by the salted hash that was sent at the beginning of sync. But that is a breaking change.

@sgwilym sgwilym added the help wanted Extra attention is needed label Mar 21, 2023
@sgwilym sgwilym changed the title Mitigate mirrored disclose message exploit Address private set intersection exploit Mar 26, 2023
@AljoschaMeyer
Copy link

The canonic solution for rather small sets is Huberman, Bernardo A., Matt Franklin, and Tad Hogg. "Enhancing privacy and trust in electronic communities." Proceedings of the 1st ACM conference on Electronic commerce. 1999.; for a very succinct summary see here, for a more accessible summary see here. Before using or implementing, ask someone who actually knows their crypto, i.e., not me.

For a fairly recent and accessible, high-level introduction to private set intersection, see this presentation.

@sgwilym sgwilym added fixed by willow and removed help wanted Extra attention is needed figure out labels May 30, 2024
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