Skip to content

Fix SMB2 directory queries escaping the configured share - #2393

Open
gabrielg5 wants to merge 2 commits into
masterfrom
fix/smb2-query-directory-containment
Open

gabrielg5 wants to merge 2 commits into
masterfrom
fix/smb2-query-directory-containment

Conversation

@gabrielg5

Copy link
Copy Markdown
Collaborator

SMB2 QUERY_DIRECTORY derived its containment root from the client’s search pattern. This allowed a client with an open directory handle to enumerate names and metadata outside the configured share. It did not expose file contents or allow writes.

This change anchors searches to the configured share root and validates both the directory being listed and each wildcard match. It rejects malformed and absolute patterns, prevents synthetic .. entries from exposing the share’s physical parent, and returns an SMB error for trees without a filesystem path. SMB1 behavior is unchanged.

@anadrianmanrique anadrianmanrique added the bug Unexpected problem or unintended behavior label Nov 25, 2026
@anadrianmanrique anadrianmanrique added the high High priority item label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected problem or unintended behavior high High priority item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants