Skip to content

Commit

Permalink
CVE-2023-4091: smbd: use open_access_mask for access check in open_fi…
Browse files Browse the repository at this point in the history
…le()

If the client requested FILE_OVERWRITE[_IF], we're implicitly adding
FILE_WRITE_DATA to the open_access_mask in open_file_ntcreate(), but for the
access check we're using access_mask which doesn't contain the additional
right, which means we can end up truncating a file for which the user has
only read-only access via an SD.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15439

Signed-off-by: Ralph Boehme <slow@samba.org>
  • Loading branch information
slowfranklin authored and Jule Anger committed Oct 9, 2023
1 parent bfe8e10 commit 3c432b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion selftest/knownfail.d/samba3.smb2.acls

This file was deleted.

4 changes: 2 additions & 2 deletions source3/smbd/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ static NTSTATUS open_file(struct smb_request *req,
dirfsp,
fsp,
false,
access_mask);
open_access_mask);

if (!NT_STATUS_IS_OK(status)) {
DBG_DEBUG("smbd_check_access_rights_fsp"
Expand Down Expand Up @@ -1633,7 +1633,7 @@ static NTSTATUS open_file(struct smb_request *req,
status = smbd_check_access_rights_fsp(dirfsp,
fsp,
false,
access_mask);
open_access_mask);

if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND) &&
posix_open &&
Expand Down

0 comments on commit 3c432b1

Please sign in to comment.