From: ChenXiaoSong <chenxiaosong@chenxiaosong.com>
To: Hang Nan <2122295973@qq.com>, Namjae Jeon <linkinjeon@kernel.org>,
Steve French <smfrench@gmail.com>
Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org,
ChenXiaoSong <chenxiaosong@chenxiaosong.com>
Subject: Re: [PATCH v2 1/2] ksmbd: bound smb_check_perm_dacl() ACE walks by DACL size
Date: Mon, 17 Aug 2026 09:40:04 +0800 [thread overview]
Message-ID: <e5395194-8f37-4641-b3f7-66138ec30338@chenxiaosong.com> (raw)
In-Reply-To: <tencent_4A67129F3CE9202D7F81A4FF94115D64DB0A@qq.com>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
On 8/12/26 18:39, Hang Nan wrote:
> smb_check_perm_dacl() validates that the DACL fits inside the NT
> security descriptor, but then bounds its two ACE walks by the
> remaining NTSD length (acl_size) rather than the DACL's declared
> size (pdacl_size).
>
> When pdacl->size is smaller than the trailing NTSD buffer, bytes
> after the declared DACL boundary - still inside the stored security
> descriptor - are parsed as ACEs during access checks. A crafted
> DACL can place an access-granting ACE beyond pdacl->size, and the
> current code accepts it during SMB2_CREATE access validation, while
> parse_dacl() and smb_inherit_dacl() stop at pdacl_size.
>
> Bound both ACE walks by pdacl_size to match the DACL boundary
> semantics used elsewhere in the server.
>
> Validation (KUnit, UML, x86_64, KASAN; first KUnit tests for
> fs/smb/server, see follow-up patch):
> - ksmbd_dacl_walk_must_stop_at_declared_size (semantic harness):
> with the current code the ACE placed after pdacl->size is
> selected and access is granted; with the fix the same sample
> is denied (EACCES).
> - ksmbd_smb_check_perm_dacl_boundary (drives the real function):
> passes with the fix; fails with the fix reverted (rc == 0).
> - ksmbd-for-next-next (rebased, base e9d76059ff03), x86_64
>
> Fixes: 8f0541186e9a ("ksmbd: fix heap-based overflow in set_ntacl_dacl()")
> Signed-off-by: Hang Nan<2122295973@qq.com>
--
ChenXiaoSong <chenxiaosong@chenxiaosong.com>
Chinese Homepage: https://chenxiaosong.com
English Homepage: https://chenxiaosong.com/en
next prev parent reply other threads:[~2026-08-17 1:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 16:04 [PATCH] " Hang Nan
2026-08-06 20:35 ` ChenXiaoSong
2026-08-07 0:54 ` ChenXiaoSong
2026-08-12 10:39 ` [PATCH v2 0/2] " Hang Nan
[not found] ` <20260812103945.82495-1-2122295973@qq.com>
2026-08-12 10:39 ` [PATCH v2 1/2] " Hang Nan
2026-08-17 1:38 ` Namjae Jeon
2026-08-17 1:40 ` ChenXiaoSong [this message]
2026-08-12 10:39 ` [PATCH v2 2/2] ksmbd: add KUnit tests for the DACL declared-size boundary Hang Nan
2026-08-12 11:28 ` ChenXiaoSong
2026-08-17 9:08 ` ChenXiaoSong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e5395194-8f37-4641-b3f7-66138ec30338@chenxiaosong.com \
--to=chenxiaosong@chenxiaosong.com \
--cc=2122295973@qq.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=smfrench@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®