Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Security] Prevent id stealing in mqtt #85

Open
freehuntx opened this issue Jul 30, 2024 · 0 comments
Open

[Security] Prevent id stealing in mqtt #85

freehuntx opened this issue Jul 30, 2024 · 0 comments

Comments

@freehuntx
Copy link
Contributor

freehuntx commented Jul 30, 2024

First of all, i know this is a huge request. But maybe it atleast gives you ideas.

Issue

MQTT is a pretty simple pubsub protocol without any authentication. This allows people to "steal" other peers id by just using the same one.

Solution

  1. Generate a public/private key using any algorithm (e.g. RSA)
  2. Use any hashing code to extract a peerId based on the public key (e.g. Sha256 it and cut the first/last x characters)
  3. Announce/Share the own public key with everybody
  4. Always sign offers/answers with the private key and share the hash
  5. Others validate the hash with the shared public key. If its valid the peers offer/answer is accepted

Notes

I know this is a rather tough one to implement. But here is my idea (to add a benefit for every protocol).
If you implement this "generally" you could have some sort of permanent peerId aka account.
By storing the private key somewhere, others could recognize you which allows to add features like "contacts/friends".
E.g.

import { selfId, writeKey, readKey } from 'trystero'

console.log (readKey()) // Prints a random generated private key (default initial behaviour)
writeKey(localStorage.getItem('my-key')) // Starts to use this new private key (selfId will change because the hash changes)


# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant