From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] main: _exit() if setuid
Date: Tue, 19 Oct 2021 12:41:03 +0200 [thread overview]
Message-ID: <20211019104103.GC28644@breakpoint.cc> (raw)
In-Reply-To: <YWyhCwDYq8zYd8Lm@salvia>
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Sun, Oct 17, 2021 at 12:56:23AM +0200, Florian Westphal wrote:
> > Apparently some people think its a good idea to make nft setuid so
> > unrivilged users can change settings.
> >
> > "nft -f /etc/shadow" is just one example of why this is a bad idea.
> > Disable this. Do not print anything, fd cannot be trusted.
> >
> > Signed-off-by: Florian Westphal <fw@strlen.de>
> > ---
> > src/main.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/src/main.c b/src/main.c
> > index 21096fc7398b..5847fc4ad514 100644
> > --- a/src/main.c
> > +++ b/src/main.c
> > @@ -363,6 +363,10 @@ int main(int argc, char * const *argv)
> > unsigned int len;
> > int i, val, rc;
> >
> > + /* nftables cannot be used with setuid in a safe way. */
> > + if (getuid() != geteuid())
> > + _exit(111);
>
> Applications using libnftables would still face the same issue.
Yes, but there is an off-chance they know what they are doing.
next prev parent reply other threads:[~2021-10-19 10:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-16 22:56 [PATCH nft] main: _exit() if setuid Florian Westphal
2021-10-17 22:17 ` Pablo Neira Ayuso
2021-10-19 10:41 ` Florian Westphal [this message]
2021-10-19 11:54 ` Pablo Neira Ayuso
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=20211019104103.GC28644@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/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.