Skip to content
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

smbserver clears Session Id on LogOff Response breaking signature verification #1829

Open
jborean93 opened this issue Oct 7, 2024 · 1 comment
Assignees
Labels
in review This issue or pull request is being analyzed

Comments

@jborean93
Copy link

Configuration

impacket version: 0.12.0 (All affected)
Python version: Any
Target OS: Any

Debug Output With Command String

There is no debug command to show this change. When an SMB2 LogOff Request is sent the smbserver.py implementation clears out the SessionId value causing the SMB2 Header to have 0 as the SessionId field.

connData['Uid'] = 0

You can see the packet capture showing that the Session Id value is set to 0 on this message.

image

While some clients might be able to just find the request the response is for and use the request's session id as the session lookup some clients may just use the value in the response header which will fail. The response from the server should continue to reflect the correct UID/SessionId from the request allowing the client to process the response and validate the signature on the response.

PCAP

If applicable, add a packet capture to help explain your problem.

Additional context

Space for additional context, investigative results, suspected issue.

@anadrianmanrique anadrianmanrique self-assigned this Oct 10, 2024
@anadrianmanrique anadrianmanrique added the in review This issue or pull request is being analyzed label Oct 10, 2024
@jborean93
Copy link
Author

I actually think Impacket may still be compliant with the spec and the logic in my client is incorrect. MS-SMB2 states https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/36172e53-ac81-48fb-b2e3-caa3761b9157

For SMB2 SESSION_SETUP, the client MUST retrieve SessionId from SMB2 header of the response. For all other messages, the client MUST retrieve SessionId from the corresponding Request.Message. The client MUST look up the session in the Connection.SessionTable using the SessionId.

So I need to update my logic to retrieve the session id from the associated request. It still would be nice to keep them aligned but I can understand if you don't wish to update the logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in review This issue or pull request is being analyzed
Projects
None yet
Development

No branches or pull requests

2 participants