-
Notifications
You must be signed in to change notification settings - Fork 41
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
Securing transit helper #10
Comments
Hm, that's an interesting idea. There's not currently any support for that: the helper will accept connections from anybody who wants, and will glue it to the second connection that uses the same token. Are you thinking of a sort of password/token that's baked into authorized clients? Or some kind of single-use access token that the e.g. mailbox server might allocate? To use either kind of token securely, we'd need to encrypt the connection to the transit helper. We don't currently do that, because all the actual data is already encrypted (using a key derived from the PAKE session key). If we don't encrypt the setup handshake too, then someone could steal the access token by snooping the network traffic (and if it's a single-use token, an active network adversary could prevent the real user from spending that token, and use it themselves). Implementation-wise, we'd put this into the handshake message. Clients currently send We'd need to make some decisions about compatibility: if a new client (configured to include the |
A token should do. The use case is running a relay for a private group of users. Abuse can be regulated by invalidating existing tokens and issuing new ones.
I wouldn't want to voice an opinion on that topic. If security is a concern then the entire communication should be encrypted anyway regardless of this use case.
That would increase usability, but specifying a protocol version as a command line argument would probably also do. |
I was implementing this today and had some points w.r.t. @warner's comments
I had considered configuring the relay with a single shared token/password (
Can't we use some kind of HMAC + nonce in this scenario?
I realise it might require a 3-way handshake, though:
My proof-of-concept simply sends a fixed-length password in the auth message:
Yeah, it seems very reasonable that if you do something like:
and the transit helper doesn't support this authentication mechanism, the client should error out. Edit: I see that this might still allow an attacker to hijack a legitimate session, but it wouldn't allow them to initiate one. |
@sigwinch28 thank you for looking into this. I guess it comes down to deciding what threats you want to guard against. The use case I'm thinking of is running a relay for myself and friends, An attacker capable of stealing tokens/passwords probably doesn't need the relay at all. Since you are working on this, would you mind implementing the functionality in a way that the relay accepts a list of passwords? This would make it easier revoking individual user access without having to re-distribute replacement passwords to all other users. |
As a drive-by contributor I'm a bit weary of adding complexity to this codebase, but my outline is:
This will require a bit of work on the client side to ensure that we don't start authenticating to random servers that don't support it (i.e. we should probably only send authentication handshakes to the listed relay, not a relay picked by the other party). |
What are user names needed for? Isn't a list of passwords enough (assuming the relay operator issues them)?
Sent from mobile - please excuse typos and terseness.
…________________________________
From: Joe Harrison <[email protected]>
Sent: Friday, March 6, 2020 12:20:36 PM
To: warner/magic-wormhole-transit-relay <[email protected]>
Cc: George Georgovassilis <[email protected]>; Author <[email protected]>
Subject: Re: [warner/magic-wormhole-transit-relay] Securing transit helper (#10)
As a drive-by contributor I'm a bit weary of adding complexity to this codebase, but my outline is:
* the server keeps a map of usernames (ids?) to passwords (preshared keys?), probably listed in a file specified as a command line flag
* at least one of the two sides must authenticate (allowing Alice to use her authenticated relay with Bob if Alice authenticates with the relay but Bob does not)
* a new 3-way handshake will be introduced:
* client: please relay $TOKEN for $SIDE and i will authenticate
* server: the authentication challenge is $NONCE
* client: my id is $USERNAME and my response is HMAC($TOKEN+$NONCE, $CONTEXT+PASSWORD)
* server computes HMAC($TOKEN+NONCE,$CONTEXT+PASSWORDS[$USERNAME])
* If HMACs are identical, server proceeds as normal (ok when buddy arrives), and if invalid the server disconnects the client
This will require a bit of work on the client side to ensure that we don't start authenticating to random servers that don't support it (i.e. we should probably only send authentication handshakes to the listed relay, not a relay picked by the other party).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#10>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA2XX4E35FNJQBTCG2OAZOTRGDMAJANCNFSM4IS34NSQ>.
|
If we don't want to send passwords in the clear (because interception of the handshake would allow an attacker to use your relay themselves by using your password) we need to either encrypt the connection between the client and server (as @warner suggested) or use something like an HMAC to verify that we're communicating with a legitimate client (perhaps via a MITM) which knows the key. If we encrypt the connection between the client and server we could just send the password over the wire and check it on the server.
If we use an HMAC, then the server needs to know which password was used to sign the message or else it would have to compute N HMACs and check each of them against the one the client sent using a constant-time algorithm to avoid timing attacks (where N is the number of passwords) |
On second thoughts, given @warner's inclination to reimplement magic-wormhole in Rust, I might write an alternative relay server implementation in Rust that uses |
I could not find instructions on how to secure the transit helper. It should be possible to set up a transit helper with a shared secret so that only clients who know the secret can use the transit helper.
The text was updated successfully, but these errors were encountered: