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

Question: Why does the protocol need to use the cookie for the signature? #565

Open
yoavschwartz opened this issue Nov 30, 2017 · 4 comments
Labels

Comments

@yoavschwartz
Copy link

Currently in the protocol documentation, I see that the proof signature is calculated as such:

// + represents concatenation, and function is HMAC-SHA256(key, message)
HMAC-SHA256(client_cookie + server_cookie,
    client_hostname       // base32-encoded client address, without .onion
    + recipient_hostname  // base32-encoded server address, without .onion
)

Why is it necessary to exchange cookies? when using hidden service, the connection in Tor performs a Diffie Halman for every connection, so a replay attack would not be possible anyways? as the keys for the DH will be different for any new connection. why would it not be enough to do something like this?

// + represents concatenation, and function is HMAC-SHA256(key, message)
HMAC-SHA256(client_hostname,
    recipient_hostname  // base32-encoded server address, without .onion
)
@s-rah
Copy link
Member

s-rah commented Nov 30, 2017

I believe this prevents attacks where the attacker is able to steal or otherwise get the Proof Spec but not compromise the private key.

For example, let's say we have 2 contacts Alice and Carol.

Under the current scheme every proof spec that Alice sends to Carol is unique, because of the cookies - you cannot use a past proof spec in a future connection.

The cookies keep the proof session specific, and requires (and therefore proves) access to the private key during authentication.

If we remove the cookies, the proof spec for when Alice connects to Carol is always identical. If someone is e.g. able to intercept traffic between ricochet and Tor then they can steal this proof spec, giving them the ability to authenticate themselves to Carol pretending to be Alice in the future.

@yoavschwartz
Copy link
Author

That's what I was thinking as well, just wanted to make sure:
But we only need the server to come up with a cookie right? since if an attacker is listening in, he can himself set the cookie that fits as needed.

@s-rah
Copy link
Member

s-rah commented Dec 1, 2017

I kind of agree. Assuming the server always generates a unique random cookie per session I cannot see an attack in which proof or protocol security is compromised by just having server cookies.

If a bug allowed server cookie reuse, meaning Alice's proof is always the same, this would break the proof of private key access for Alice...but would be a bug in the server.

Having both a client and server cookie means that both parties have to have broken cookie generation to violate the private key access proof. I'm not sure how strong this argument is though.

The client cookie adds a nice symmetry to the protocol, and prevents any one party having control over the HMAC key (but there should be no way an evil server can abuse this to trick the client into building a proof that would work to authenticate to another server?)

I might have missed something and I'd like to see if @special has any insights on this.

@jes
Copy link

jes commented Sep 5, 2018

Having both a client and server cookie means that both parties have to have broken cookie generation to violate the private key access proof.

But a malicious client can just reuse whatever cookie it wants anyway.

I don't think there's any real argument for removing the client cookie, but I don't see how it adds any security.

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

No branches or pull requests

4 participants