-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Plaintext connection despite encryption enabled #550
Comments
It work fine to me. don't know why windows client doesn't send encrypted request since session setup. I can not find any clue in your dump. Can you check it against samba ? |
Samba is working fine: I've found a small issue I think it could be the culprit, and it is that the 3.1.1 handler in smb2ops.c mistakengly sets the SMB2_GLOBAL_CAP_ENCRYPTION flag on the negotiation response which Samba does not. According to Microsoft's SMB2 and 3 protocol standard section 2.2.4 in page 54, this flag should not be set:
|
Okay, Can you check problem is fixed after removing this lines you found ? |
I already thought so but that disables encryption completely, as smb2pdu.c uses it as a condition to enable AES keygen. Further modifying the code (https://github.com/socram8888/ksmbd/tree/no-enc-flag) seems quite promising, as the client seems to indeed request encryption, but I am facing a kernel crash after these changes which I am still not sure if related or not to my changes. I'll try on a non-embedded device for easier debugging, since I can't read the dmesg to know the reason. |
The crash seems to be caused by something else, as the modded ksmbd module loads and runs fine on an Alpine installation, so I've opened #551 to merge the changes. I've also checked that this bug does not affect 3.4.2 if using dialects 3.0 or 3.0.2, which do use the flag and the session is properly encrypted, so as a mitigation for anyone affected you might wanna do that. |
Closing this, as the patch will be merged with Linux kernel instead: https://lkml.org/lkml/2021/12/16/336 |
Thanks for your work and I will apply this patch to out of tree ksmbd soon. |
Awesome. Thank you for creating ksmbd as well :) |
Hello. I am facing an error with the latest stable v3.4.2 version, running on an OpenWRT machine. My configuration file is as follows:
Despite "smb3 encryption" set to yes, communications are still being made in plain text according to Wireshark.
During the initial negotiation, both the client (a Windows 10 machine running 21H1, compilation 19043.1348) and the server agree on using 3.1.1 and AES-128-GCM:
On the the session setup request, however, the client decides to no longer flag it supports encryption, and thus request a plain text connection for unknown reasons:
Worse is, ksmbd agrees and goes on, ignoring the request to enforce encryption and just sending data on plain. The following screenshot displays a plain text ASCII message from opening a file which shouldn't be visible:
I am not sure if being made in plain text is an error on the Windows side or not, but at the very least ksmbd should probably deny connections if the user requested encryption in the settings.
Attached here is a .zip file with a Wireshark log of the entire packet exchange, from the initial connection to the desconnection: comms.zip
The text was updated successfully, but these errors were encountered: