-
Notifications
You must be signed in to change notification settings - Fork 450
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
Addressing the various security improvements #1066
Comments
For the record, I have nothing against the concept of what you all are trying to do, and think it's an admirable goal, and do wish you all the best of luck. That said, there is a lot of work that needs to go into certain kinds of systems before real users should see them. With regards to the improve_crypto branch, here, have some followup:
Obligatory disclaimer: Even fixing the further issues is probably still not enough to protect the system from adversaries, including those in your threat model. Without fixing said issues, both master and the improved branch (which does have some nice cleanups), will not protect vs a bored undergrad. |
@Yawning many thanks again for these comments. I've removed the custom DH and replaced it by the one included in M2Crypto/OpenSSL. Again, why we choose to implement DH ourselves instead of using this version is beyond me. Regarding the gmpy's rand method, after reading the docs I was really under the impression that letting gmpy set the seed would suffice. But its clear now that it does not. |
@Yawning all references to rand are now gone, additionally the ECElgamal code now uses a k which is relatively prime to the modulus of the curve. |
@NielsZeilemaker Glad to hear it. What's most important to me is that all these things get fixed, and I'm glad to see that you're working hard (though you should also remember to enjoy the holidays). If you want someone to talk to about how to do the symmetric cryptography in a manner suited for the UDP transport, feel free to drop me an e-mail (at either the one I used to post to tor-dev or at my torproject.org one), since it's a problem space I'm relatively familiar with. |
@Yawning I guess the first thing to do now, is replace the custom ecelgamal with one implemented by a library. Do you have a pointer towards a reliable library which implements it? |
I'm moving this to v6.4.2 milestone as we are releasing v6.4.1 today. |
Note that 6.4.1 has all the fixes except for the ECElgamal replacement. |
@Yawning I was thinking to replace the custom ecelgamal stuff with an approach describe here |
Hmm, if you're ok with breaking wire protocol compatibility, I included the suggestion to use the newer ntor handshake in my initial draft. I'll expand a bit more on that, since while what you suggest will work, there's no need to reinvent the wheel. "ntor" is the current Tor link layer crypto handshake, that was introduced to address certain issues with the older TAP hybrid Diffie-Hellman/RSA handshake (which is what your current DH/ECElgamal handshake is based on). It is Curve25519/SHA-256 based (the primitives don't matter too much, though for performance reasons the key exchange algorithm should be an ECDH variant, and I tend to favor Curve25519 over ECDH with the NIST curves lately). The older TAP handshake is extremely close to being deprecated (0.2.3.x needs to go away first). The original paper (which includes the security proof): https://cypherpunks.ca/~iang/pubs/ntor.pdf You'll need a Curve25519 implementation:
How I think you all would implement it if you decide to go this route (Using variables from our spec, not the paper): Setup:
The handshake (Alice is the initiator, Bob is the recipient):
After step 6 (Bob) and step 9 (Alice), both sides have KEY_SEED that is identical (256 bits of material), and Alice is confident that Bob is actually Bob. I suggest using HKDF-SHA256 to expand that to actual session keys (The post you linked uses SHA-1 ewww), and using separate keys for Alice->Bob and Bob->Alice traffic at a minimum. It's relatively simple to implement and there aren't that many implementation pitfalls unique to this, though I will note some of them here:
Possible improvements over what Tor currently does:
|
@Yawning Thank you for the review! We got a bit more exposure lately then we expected. Hopefully in a few months we can do another review round and share the progress with the tor-dev people. Hopefully things can mature in a few releases.. |
@Yawning Many thanks from me as well. |
Retransmission/reordering shouldn't come into the picture assuming you're willing to incur extra overhead on a per hop per packet basis. The current design does allow arbitrary hops, but that's not a great idea due to attacks highlighted in my initial analysis (Tor explicity does not allow users to configure the path length, see https://www.torproject.org/docs/faq.html.en#ChoosePathLength and http://freehaven.net/anonbib/cache/ccs07-doa.pdf). If we are ok with this (it's kind of unavoidable, unless you want to get into opportunistic decryption, which is performance intensive and kind of scary in the pathological cases), we might as well also fix the authentication issue while we're at it. That said here is an example of what I would do if I had to use AES (In this case GCM-AES), with the usual caveat that it's off the top of my head and will probably need tweaks. First, let's reuse the nonce definition from RFC 5288.
The salt portion is fixed per circuit (Derive separate ones for Client to Server/Server to Client as part of the KDF output during the handshake), the nonce_explicit is a counter in network byte order that is initialized to 1, and incremented per packet. Extremely bad things happen when nonces are reused for GCM mode, so either kill the circuit when it wraps or implement rekeying (hard). Change the cell format to be something like:
The decryption flow looks like this:
Retransmission by the utp layer doesn't matter, because the tunnel code treats a retransmitted packet just like any other data (increment nonce_explicit, if it didn't wrap, send). Reordering doesn't affect successful decryption because Pitfalls, downsides, recomendations:
Season's greetings. |
@Yawning I've got two question for you
Thanks again |
@NielsZeilemaker Hihi.
To convert that into session keys:
Building the iv looks like:
NB: As usual this is off the top of my head, and I haven't written python lately. It should get the point across. |
@synctext I guess this is not going to be finished for 6.4.2, right? |
@whirm If you add the new dispersy pointer to next, I'll have a go at changing the tunnel community this weekend to see if I can get it too work with the new curve25519. |
@NielsZeilemaker I guess you can branch off that branch and send one back to devel when it works :) |
@Yawning Creation of fake accounts remains a key vulnerability for self-organising systems in general and thus Tribler. I have now a draft 10-page write-up of how we aim to deal with Sybil attacks (3 defense layers). The recent Lizard Squad events make this quite relevant it seems. Have you worked on this research topic? @NielsZeilemaker impressive progress (Tribler/dispersy#385). Thnx! @whirm for 6.4.2 I guess we just ship it when we have sufficient bug fixes and improvements. |
@Yawning I made most of the changes in a new pull request #1117.
Could you have a look if I made any blatant mistakes? |
@synctext: @NielsZeilemaker said that this was basically done. Can you close this if it's OK? |
I'm closing this, one, @synctext: feel free to reopen it if it's not really finished. |
An update on the 2018 status of these security matters for people which followed a link from 2014 or beyond. Dispersy was correctly identified by Yawning Angel as a vulnerability. We have build a replacement. We are now in the process of removing Dispersy for our new overlay. |
@synctext Was the last point |
@dreamflasher We moved to AES-GCM back in 2015, and more recently we started using ChaCha20/Poly1305. We just forgot to tick the checkbox. |
@egbertbouman Thank you very much for the swift update, I am very happy to hear that! |
Updated error when community_id is missing GUI settings should store api_key as bytes for compatibility with previous versions of Tribler
Updated error when community_id is missing Add test for token balance for better coverage
Several issues where listed by "Yawning Angel" on Tor mailing list.
A casual review brought up some issues and we here provide a structured reaction to them. All issues are addressed already or will be fixed soon.
In general, the reviewer is correct, our code needed to be written more clearly and dead code was insufficiently cleaned.
Issues:
This shouldn't be used in the wild, and wasn't/isn't used in the tunnels.
A pull request is submitted which fixes the dodgy optional_crypto file, by removing the optional part.
Yes, we are aware of this issue. ECB-AES128 needs to be replaced asap with our new code that adds packet loss resilience. We aim to use CTR mode instead, and compensate for UDP packet loss with optimistic decryption that uses sequence number estimation, please read our detailed report: http://repository.tudelft.nl/view/ir/uuid%3Ace3bd867-6540-426d-87d0-348bdf78279d/
The text was updated successfully, but these errors were encountered: