-
Notifications
You must be signed in to change notification settings - Fork 378
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
Secure against interception of RevealSecret messages #473
Comments
As we had discused in the Berlin meeting we would need message encryption for this issue. As we can have message encryption with Matrix transport this could be handled easily then but for Red Eyes we don't want to switch encryption on. As such this issue is going out of Red Eyes. |
Hey folks, came across the link to this issue while reading the docs, and wanted to make sure I understand what's being described correctly. As it is written, this line is a bit confusing to me:
When would B be able to intercept a message that is being passed to C and prevent C from receiving? Isn't the path through the overlay network only meant to represent the path of the payment channels? Why would messages also be sent along this path, rather than just directly from A to C? Or is this describing a man-in-the-middle attack where somehow B has also compromised A or C's access to the internet? Thanks in advance for the clarification. |
Hi @Zerim , It describes the second case |
Having a constant lock expiration is sufficient only if the secret is revealed on-chain, if the secret is revealed off-chain then the constant expiration is not sufficient. |
I had a discussion about this with @hackaugusto and @LefterisJP . I prefer encryption with the receiver's Ethereum public key because
It's possible to encrypt data with Ethereum public keys: https://github.com/LimelabsTech/eth-ecies. |
I found a Python library, too https://pypi.org/project/eciespy/ . |
I've already thought about ECIES, the problem with it is that it may lock us out of scenarios where we don't have the private key: e.g. light clients on browser, eth node-side signing (#1402). |
@andrevmatos, hm, that sounds like a blocker. I came up with some more alternatives. Are these clear? Does anybody have more ideas?
My favorite is 3a. The runtime overhead seems the smallest. No dependency on a transport layer. No need to access the Ethereum priv key. |
Here is a Python Diffie-Hellman library. |
I talked with @hackaugusto . I think I heard
|
I guess the next step is for me to figure out how to do the Diffie-Helman option.
Initiator-->Target encryption of RevealSecret
|
@hackaugusto @andrevmatos @LefterisJP Do we need encryption on the backward RevealSecret? I'm thinking. --> Got an answer, no need to. Because, I think, in any unhappy case, the unhappy party can go onchain and use the secret. |
We have another issue, where alternatives were discussed. I strongly support to combine it with your proposal 2. to rule out different classes of attacks. |
Again, ECIES for me, although interesting, is a blocker due to the requirement of PK access.
Advantages:
E.g. of JS implementation: https://github.com/indutny/elliptic |
@andrevmatos could you elaborate on 3.? |
@err508 curve25519 ECDH (encryption) pubkey will be retrieved from partner's public displayname on matrix' service. This curve has the property that |
could you explain how this part works in more detail? |
@err508 Currently, matrix user's displayname is the signature of the userId, and is used to prevent personification:
Notice in this last, more complete example, ecdh_pubkey both goes appended in the displayname, retrievable by anyone interested in communicating with it, and on hashed/signed data that is validated by every peer, and user is ignored if this signature is invalid. |
Python's implementation (not sure if compatible with js's ellyptic, but the idea is the same): https://pynacl.readthedocs.io/en/stable/public/ |
I'm not sure what happens if Mallory uses And in your proposal, how does |
Because of @andrevmatos 's requirement, I'm going after 3a (symmetric session key).
|
@err508 This is how displayname is set on the client. It comes automatically from matrix server on each event related to the user to interested partners (users participating in the same room, etc). This is how the events are validated in the clients, to ensure user's authenticity. |
Oh, missed this: peer's |
@andrevmatos @pirapira If we derive a secure |
@err508 everytime a user is used for anything in matrix, through the function in the second link in my comment above. That validation is the bridge between a matrix user and the corresponding eth address. |
@andrevmatos D-H session key generation doesn't require |
@err508 "parallelize" means creating a separate GitHub issue? |
@pirapira care to explain how my solution is not e2e encryption? |
e2e
Without thinking, I excluded the transport layer from the endpoint. Let me rephrase. I think the missing encryption is a problem in the Raiden protocol, and should be solved in it if cheap. Delivered
Oh, I didn't understand your comment then:
|
@hackaugusto explained me
in the issue description. For this issue, now I prefer this solution, rather than encryption with session keys. Reasons:
Sorry for my changing opinions. I'm willing to clean up my previous comments if that helps. I have to reflect a bit over how I proceeded with this issue. I think I should have read everything over carefully or talked with somebody before picking a choice. |
@hackaugusto came up with another solution: to require the target's signature on the secret [edit: not on I think this might involve:
I think the offchain part only is already useful. If the backward RevealSecret needs to contain the target's signature on the secret, an interceptor needs to reveal the secret onchain, so the target notices the attack. |
I can't see how this solves the problem coherently; a mediator might still be able to intercept the signed secret and selectively disclose it, no? Encrypting the secret with the targets public key fullfills the same function (i.e. assuming initiator and target follow the protocol; any mediating node will know, that the secret originated from the target) but intercepting an encrypted secret doesn't yield any information, where intercepting a signed secret does. In general, I'd reuse as much existing primitives/schemes as possible, not only to reduce engineering overhead...
@andrevmatos I see, would you be so kind to point me to the code where the onchain properties of the eth address are validated(For example that we have a channel with |
Yes, but the mediator does not have an advantage over the target because the target has already acquired the secret (see, the secret has been signed by the target already). See my edit above.
I think 4. is optional. |
@err508 on platforms like MetaMask, private keys are not available for decrypting messages, but for signing messages. That's one reason why "requiring the target's signature on the secret" approach is interesting. Also we already use signatures but we haven't used encryption yet, so the signature approach keeps the number of crypto schemes low. |
I see, but could an interceptor with the ability to censor traffic from the target selectively disclose the signed secret only to a subset of mediating nodes, forcing the target and other mediators to go onchain? I understand that we might not want to use the eth private key for encryption directly, but if understand @andrevmatos proposal correctly, we might derive a |
I agree that this path exists. I doubt any solutions prevent these kinds of behavior. |
I agree that it might be difficult to prevent this behaviour, but if we use per-hop encryption, interception is not useful anymore and an attacker is at least required to be part of the route to gain knowledge of the secret, right? |
@err508 transport is informed of "interesting" partners (today, addresses we've a channel with or a pending incoming/outgoing mediated transfer) through Transport.whitelist method, which is also called from Transport.start_health_check. Events (invites, messages) coming from whitelisted addresses are always processed and pushed to core, ignored otherwise. Transport does no further validation, this is just a first-line of defense/dos protection. It's core's responsibility to fully validate these events against the state and ignore/warn/close/settle on wrong state transitions/messages. |
Yes, in my threat model for this issue, a malicious mediator has access to what goes through the transport layer. There are ways to make sure that the target is the first one who can open the hashlock. |
Removing my own assignment. There seem to be more urgent security issues around. |
I heard from our advisors that the same keypair should not be used for different primitives (signature & encryption). And one of them started talking about deriving child keypairs.
|
With the switch to |
Problem Definition
For a mediated transfer ABC, where B is the attacker, B is choosing the expiration for the lock BC and is in a position to choose a low expiration time, given that C receives the BC mediated transfer and send a SecretRequest to A, followed by the SecretReveal message from A to C, if B is in a position to intercept the message he can learn the secret while making sure that C won't, that means B can wait for the BC lock to expire and then unlock the AB lock.
Note: Assuming that an attacker can intercept and drop messages and that we don't have guaranteed delivery of messages.
Solution
Possible solutions:
Enforce constant lock expiration through out the pathTasklist
Related
Provide a receipt for payments #368
Add Ack authentication #44
The text was updated successfully, but these errors were encountered: