From: Jeremy Allison <jra@samba.org>
To: Hyunchul Lee <hyc.lee@gmail.com>
Cc: linux-cifs@vger.kernel.org,
Ronnie Sahlberg <ronniesahlberg@gmail.com>,
Ralph Boehme <slow@samba.org>, Steve French <smfrench@gmail.com>,
Namjae Jeon <linkinjeon@kernel.org>
Subject: Re: [PATCH v4] ksmbd: use LOOKUP_BENEATH to prevent the out of share access
Date: Fri, 24 Sep 2021 10:20:31 -0700 [thread overview]
Message-ID: <YU4I3zUm3UOOXrBz@jeremy-acer> (raw)
In-Reply-To: <20210924150616.926503-1-hyc.lee@gmail.com>
On Sat, Sep 25, 2021 at 12:06:16AM +0900, Hyunchul Lee wrote:
>instead of removing '..' in a given path, call
>kern_path with LOOKUP_BENEATH flag to prevent
>the out of share access.
>
>ran various test on this:
>smb2-cat-async smb://127.0.0.1/homes/../out_of_share
>smb2-cat-async smb://127.0.0.1/homes/foo/../../out_of_share
>smbclient //127.0.0.1/homes -c "mkdir ../foo2"
>smbclient //127.0.0.1/homes -c "rename bar ../bar"
FYI, MS-FSCC states:
"Except where explicitly permitted, a pathname component that is a dot directory name MUST NOT
be sent over the wire."
so it might be easier to just refuse with an
error a pathname containing "." or ".." on input
processing rather than try and deal with it.
Might be interesting to test this against a
Windows server and see what it does here.
next prev parent reply other threads:[~2021-09-24 17:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 15:06 [PATCH v4] ksmbd: use LOOKUP_BENEATH to prevent the out of share access Hyunchul Lee
2021-09-24 17:20 ` Jeremy Allison [this message]
2021-09-25 0:08 ` Namjae Jeon
2021-09-25 0:21 ` Namjae Jeon
2021-09-25 0:43 ` Namjae Jeon
2021-09-25 17:45 ` Steve French
2021-09-28 15:18 ` Tom Talpey
2021-09-29 12:40 ` Namjae Jeon
2021-09-29 15:01 ` Tom Talpey
2021-09-29 23:52 ` Namjae Jeon
2021-09-30 0:01 ` Hyunchul Lee
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=YU4I3zUm3UOOXrBz@jeremy-acer \
--to=jra@samba.org \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=ronniesahlberg@gmail.com \
--cc=slow@samba.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