News for hackers. Stuff that matters.

Show HN: An Elliptic Curve-Based Secure Chat, Written Using Rust and Protobuf

https://github.com/vaktibabat/ecurvechat

This is a project I made to learn more about crypto. I've also written a [post](https://vaktibabat.github.io/posts/ecurvechat/) that explains all the crypto concepts and algorithms used in the project, and how I implemented them. I'd be very glad for any feedback about both the code and the post :)
( 7 comments | 3 points | on HN )
Re:Show HN: An Elliptic Curve-Based Secure Chat, Written Usi... by woodruffw on Thursday September 19, 2024 @05:57PM (#41596794)
First of all, nice work! Learning by doing is great, especially with cryptography.

Some observations from a very quick scan:

1. You should include a disclaimer somewhere in the repo that this is an educational project, not something people should seriously use. This is the "escape hatch" for the "don't roll your own crypto" rule.

2. You're rolling your own curve math, including ECDH and ECDSA. These are not easy to get right; in particular, it looks like you've got a classic "attacker can send you a point not on the curve" bug here[1], unless I'm missing where you validate the other party's point.

3. Your protocol seems to allow variance over the curve parameters, which is notoriously dangerous (and is why X.509 and similar protocols prefer "named curve" sets over explicit parameter sets).

[1]: https://github.com/vaktibabat/ecurvechat/blob/4a1d91bd02bbc8...

Re:Show HN: An Elliptic Curve-Based Secure Chat, Written Usi... by 0x457 on Thursday September 19, 2024 @08:25PM (#41597668)
I think size of the readme covers #1
Re:Show HN: An Elliptic Curve-Based Secure Chat, Written Usi... by vaktibabat on Friday September 20, 2024 @02:12AM (#41599278)
Thank you! I'll try fixing these.
Re:Show HN: An Elliptic Curve-Based Secure Chat, Written Usi... by GraphEnthusiast on Thursday September 19, 2024 @09:08PM (#41597868)
Implementing an Elliptic curve correctly is tricky, and in your post a quick CTRL-F didn't turn up the phrases "constant time" or "side channel". A good next step would be to look up various side channel attacks on elliptic curve implementations and work through mitigating them.

Also, your README needs a disclaimer, like others have said.

Re:Show HN: An Elliptic Curve-Based Secure Chat, Written Usi... by vaktibabat on Friday September 20, 2024 @02:14AM (#41599289)
Thanks! Mitigating side channel attacks does seem like an interesting next step, I'll try doing it.
Re:Show HN: An Elliptic Curve-Based Secure Chat, Written Usi... by simonjgreen on Thursday September 19, 2024 @09:28PM (#41597979)
I love the learning project :)

Now invite people to break it

Re:Show HN: An Elliptic Curve-Based Secure Chat, Written Usi... by vaktibabat on Friday September 20, 2024 @02:12AM (#41599281)
Thank you :)