Upgrade rendezvous KeyExchange to a v1-style transcript-bound key derivation
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust
- Domain
- backend-api-design, networking, security
Research direction
Start with rendezvous.proto, then read handle_listener_inner and the KeyExchange arm in handle_tcp. Compare the existing client-side version selection in rustdesk's common.rs and the Kx v1 tests from #16326. Done means version negotiation, v0 compatibility, v1 split-key exchange, and downgrade-tampering coverage work for rendezvous connections.
Written by the indexing model from the issue text.
Description
Context
#706 fixed a real bug where hbbs never sent a KeyExchange message at all in TCP (secure_tcp) mode, leaving clients waiting forever (#394). That fix uses the original ("v0") scheme: one shared symmetric key for both directions, derived via Encrypt::decode/box_::seal.
During review, rustdesk/rustdesk#16326 ("Kx v1") was flagged as a possibly-related upgrade already available in hbb_common. Traced it down (see this comment on #706 for the full analysis):
- #16326 added
kx_versiontoPublicKeyinmessage.proto— the direct peer-to-peer connection handshake (client-to-client, relayed via hbbr). rendezvous.proto's ownKeyExchange(the hbbs-to-client rendezvous handshake #706 fixes) is a different message, untouched by #16326, and has no version field.
So the v1 upgrade doesn't apply to rendezvous connections automatically — but the underlying crypto primitives it introduced in hbb_common (tcp::Encrypt::new_split, tcp::KxTranscript, kx_version_for) are generic and already available. Adopting them for the rendezvous handshake too would give it the same improvement #16326 gave the peer-to-peer one: per-direction split keys derived from a transcript that binds both ephemeral public keys and the negotiated version, closing the downgrade-attack surface a single shared v0 key leaves open.
Proposed scope
- Add a
kx_versionfield toKeyExchangeinrendezvous.proto(mirroringPublicKey's new field), defaulting to absent/0 for backward compatibility with clients that don't send it. - Server (
handle_listener_inner) advertiseskx_version_for(KX_VERSION_LATEST)alongside its existing signed ephemeral key. - Client picks the highest mutually-supported version (existing client-side logic in
rustdesk/rustdesk'scommon.rsalready does this for the peer-to-peer case — same pattern, different message). - Server (
handle_tcp'sKeyExchangearm) branches on the picked version:0keeps today'sEncrypt::decode/Encrypt::new,1builds aKxTranscript(initiator/responder ephemeral pubkeys + advertised/picked versions) and callsEncrypt::new_split. - Tests mirroring #16326's own: version compatibility, bidirectional exchange, downgrade-tampering (a MITM forcing version 0 when both sides support 1 should be detectable/rejected, matching the transcript-binding's whole point).
Why a separate PR
#706 is a narrow, already-tested fix for a real, currently-broken connection path (real user confirmed fixed). This is a genuine security hardening on top of a now-working baseline, not a blocker for it — better scoped, reviewed, and tested independently.
- Dominant language
- Rust
- Stars
- 10.4k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rustdesk/rustdesk-server
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
rustdesk/rustdesk-server#708 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 55/100
rustdesk/rustdesk-server#704 · 1 comment ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
rustdesk/rustdesk-server#701 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 43/100
rustdesk/rustdesk-server#678 · 14 comments · 4 reactions ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
rustdesk/rustdesk-server#677 · 2 comments ·
All issues in rustdesk/rustdesk-server
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
area: cli bug priority: P2 ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day