public inbox for netfilter-devel@vger.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Alan Ross <alan@sleuthco.ai>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] security: use secure_getenv() to prevent env-var privilege escalation
Date: Thu, 12 Feb 2026 01:18:36 +0100	[thread overview]
Message-ID: <aY0cXHepIpELznWA@strlen.de> (raw)
In-Reply-To: <CAKgz23GWzqiryJwfjJyf7ObTkAnLciFZ6vKXcxACtm-N8xZi-w@mail.gmail.com>

Alan Ross <alan@sleuthco.ai> wrote:
> >> Would you have the cycles to go through all of nf software to make this
> change?
> 
>   Yes, happy to take this on. I'll work through them in order: nftables,
> ipset, conntrack-tools, ulogd. iproute2 I can
>   look at as well, though that's a separate tree/maintainer so I'd send
> those separately.

Sure, iproute2 patches go to netdev@ , not to netfilter-devel.

>  >> I think it just needs a rework of the commit message
> 
>   Will do — v2 will lead with the setcap/container-runtime scenario as the
> motivation.

Thanks!

>  >> Any reason for the wrapper to not do getauxval(AT_SECURE)?
> 
>   No good reason. getauxval is available since glibc 2.16 (one release
> before secure_getenv in 2.17), and since this is
>   all Linux-only code there's no portability concern. Your version is
> cleaner — I'll use that for the fallback.

Alright.

>   In practice the #ifdef HAVE_SECURE_GETENV path will hit on anything
> remotely modern, but agreed the getauxval fallback
>    is simpler than a uid/euid comparison.

Agreed, it should not be hit in practice.

>  >> Another option is to alter ef7781eb1437a ("libxtables: exit if called
> by setuid executable") to enforce non-capability
>    binary
> 
>   That would work as a first step for xtables specifically — extend the
> existing getuid() != geteuid() check to also
>   bail on getauxval(AT_SECURE). The secure_getenv changes would then be
> belt-and-suspenders on top. Want me to include
>   both in v2, or would you prefer the enforcement-first approach across the
> nf suite?

I would prefer enforcement-first, but you are free to followup with
getenv_secure if you want.  I mean, the change isn't wrong, I am just
not sure there isn't anything else that we might be missing.

xtables has a plugin architecture, so we don't know what other
extensions that might get shipped by some distros do.

For nftables, thats less of a concern, BUT I don't know what some of the
libraries we link against do with untrusted input.  Or what will happen
when nft is invoked with stdin/stdout/stderr closed.

So I would prefer to enforce a no-setcap/setuid approach in any case
and followup with secure_getenv later.

> I'll start with the iptables v2 (reworked message + getauxval fallback)
> and then work through nftables and the others
> as follow-up series.

Thank you, much appreciated.

      parent reply	other threads:[~2026-02-12  0:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11 14:19 [PATCH] security: use secure_getenv() to prevent env-var privilege escalation Alan Ross
2026-02-11 17:06 ` Florian Westphal
     [not found]   ` <CAKgz23Hendu+Y=rhSwupr30Vf0JuJS5b6D-vp8A0TAC2swA-Bw@mail.gmail.com>
2026-02-11 19:03     ` Florian Westphal
     [not found]       ` <CAKgz23GWzqiryJwfjJyf7ObTkAnLciFZ6vKXcxACtm-N8xZi-w@mail.gmail.com>
2026-02-12  0:18         ` Florian Westphal [this message]

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=aY0cXHepIpELznWA@strlen.de \
    --to=fw@strlen.de \
    --cc=alan@sleuthco.ai \
    --cc=netfilter-devel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox