pikvm / pikvm

Open and inexpensive DIY IP-KVM based on Raspberry Pi
https://pikvm.org
GNU General Public License v3.0
8.01k stars 447 forks source link

kvmd vnc server is not compatible with client talking RFB Protocol 3.3 #1349

Closed zhangyoufu closed 2 months ago

zhangyoufu commented 3 months ago

Describe the bug RFB Protocol 3.7/3.8 negotiate security types. Server sends an array and client choose one. Security type is encoded as u8.
RFB Protocol 3.3 does not negotiate security types. Server decides the security type and sends a single u32.

To Reproduce Steps to reproduce the behavior, like:

  1. Capture VNC packet between client and server
  2. Connect to kvmd vnc server using a VNC client that only supports RFB Protocol 3.3
  3. Wireshark dissector shows that server sent a malformed Security types supported

Expected behavior kvmc vnc server is expected to downgrade protocol version to RFB Protocol 3.3

Screenshots

RFB-malformed

Desktop (please complete the following information):

PiKVM info:

zhangyoufu commented 3 months ago

I understand that PiKVM requires a VNC client that supports either Tight(JPEG) or H.264. Both encoding are not available for RFB Protocol 3.3 clients.

Please simply drop support for RFB protocol < 3.7 and reject connection earlier.

mdevaev commented 3 months ago

Hello. Tight can be used with 3.3, he version only applies to the protocol, not extensions. I think we can just add the correct handling of the 3.3 handshake.

zhangyoufu commented 3 months ago

3.3 spec defined raw(0), copy rectangle(1), RRE(2), CoRRE(4), hextile(5) without mentioning Tight though.

zhangyoufu commented 3 months ago

I opened a pull request for this issue, please checkout. I don't have a working RFB 3.3 client to perform e2e test. But my client passed security type handshake and shows PiKVM.

mdevaev commented 2 months ago

Merged, thank you.