All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Stefan Metzmacher <metze@samba.org>,
	Namjae Jeon <namjae.jeon@samsung.com>
Cc: 'CIFS' <linux-cifs@vger.kernel.org>,
	'Steve French' <smfrench@gmail.com>,
	'samba-technical' <samba-technical@lists.samba.org>,
	'Hyunchul Lee' <hyc.lee@gmail.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: updated ksmbd (cifsd)
Date: Wed, 16 Dec 2020 13:21:36 +0900	[thread overview]
Message-ID: <X9mLUOxGI8QM/tgV@jagdpanzerIV.localdomain> (raw)
In-Reply-To: <X9l9/7rttZkNc389@jagdpanzerIV.localdomain>

On (20/12/16 12:24), Sergey Senozhatsky wrote:
> On (20/12/15 15:29), Stefan Metzmacher wrote:
> > >> 6. Why is SMB_SERVER_CHECK_CAP_NET_ADMIN an compile time option and why is it off by default?
> > >>    I think the behavior should be enforced without a switch.
> > > I can make it default yes. Can you explain more why it should be enforced ?
> > 
> > Why should an unprivileged user ever be able to start the server?
> > Wouldn't that be a massive security problem as that user would provide
> > the share definitions and users and controls what ksmbd_override_fsids() will use?
> 
> The idea was that user-space needs to have its own user:group
> (e.g. CIFSD:CIFSD). And smb.conf and password file should not
> be readable by anyone who's not from CIFSD:CIFSD - similar to
> how .ssh/config is 0700 on any reasonably configured system.
> 
> The massive security problem here is that the server runs in
> the kernel. So I don't always see why people want to also run
> user-space (which serves RPC calls, and technically can be
> tricked to do something that it was not intended to do) under
> root - wouldn't this just increases the attack surface?

So SMB_SERVER_CHECK_CAP_NET_ADMIN enforces the "user-space must
be a privileged process" policy. Even CAP_NET_ADMIN is too huge,
not to mention that _probably_ this CAP requirement means that
people will just "sudo cifsd". One way or another a malformed
RPC request can do quite a bit of damage to the system, because
user-space runs with the CAPs it doesn't really need.

It would be better to enforce a different policy, IMHO.
Something like:

	groupadd ... CIFSD_GROUP
	useradd -g CIFSD_GID -p CIFSD_PASSWORD CIFSD_LOGIN
	chmod 0700 smb.conf and password db
	chown CIFSD_LOGIN:CIFSD_GROUP smb.conf and password db

And perhaps we need to add some checks to the user-space cifsd:
make sure that smb.conf and password db are 0700 + some more.

	-ss

  reply	other threads:[~2020-12-16  4:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14  1:20 updated ksmbd (cifsd) Steve French
2020-12-14 12:46 ` Namjae Jeon
2020-12-15  2:28   ` Namjae Jeon
2020-12-14 17:45 ` Stefan Metzmacher
2020-12-14 18:48   ` Jeremy Allison
2020-12-15  2:29     ` Namjae Jeon
2020-12-15  4:13       ` Jeremy Allison
2020-12-15  2:28   ` Namjae Jeon
2020-12-15 14:29     ` Stefan Metzmacher
2020-12-16  3:24       ` Sergey Senozhatsky
2020-12-16  4:21         ` Sergey Senozhatsky [this message]
2020-12-17  3:29           ` Sergey Senozhatsky
2020-12-16  8:50       ` Namjae Jeon

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=X9mLUOxGI8QM/tgV@jagdpanzerIV.localdomain \
    --to=sergey.senozhatsky@gmail.com \
    --cc=hyc.lee@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=metze@samba.org \
    --cc=namjae.jeon@samsung.com \
    --cc=samba-technical@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.