lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 7 Jul 2021 21:22:12 +0800
From:   iLifetruth <yixiaonn@...il.com>
To:     Pablo Neira Ayuso <pablo@...filter.org>
Cc:     Jozsef Kadlecsik <kadlec@...filter.org>,
        Florian Westphal <fw@...len.de>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        netfilter-devel@...r.kernel.org, coreteam@...filter.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Qiang Liu <cyruscyliu@...il.com>, yajin@...kernel.org
Subject: Re: netfilter: Use netlink_ns_capable to verify the permisions of
 netlink messages

I see.
There is no need to check the capability again in the
nfnetlink_cthelper and nfnetlink_osf now.

Regards and thanks for your analyze,
- iLifetruth




On Wed, Jul 7, 2021 at 5:18 PM Pablo Neira Ayuso <pablo@...filter.org> wrote:
>
> On Wed, Jul 07, 2021 at 04:05:33PM +0800, iLifetruth wrote:
> > Hi, we have found that the same fix pattern of CVE-2014-0181 may not
> > forward ported to some netlink-related places in the latest linux
> > kernel(v5.13)
> >
> > =============
> > Here is the description of CVE-2014-0181:
> >
> > The Netlink implementation in the Linux kernel through 3.14.1 does not
> > provide a mechanism for authorizing socket operations based on the opener
> > of a socket, which allows local users to bypass intended access
> > restrictions and modify network configurations by using a Netlink socket
> > for the (1) stdout or (2) stderr of a setuid program.
> >
> > ==========
> > And here is the solution to CVE-2014-0181:
> >
> > To keep this from happening, replace bare capable and ns_capable calls with
> > netlink_capable, netlink_net_calls and netlink_ns_capable calls. Which act
> > the same as the previous calls *except they verify that the opener of the
> > socket had the desired permissions as well.*
> >
> > ==========
> > The upstream patch commit of this vulnerability described in CVE-2014-0181
> > is:
> >     90f62cf30a78721641e08737bda787552428061e (committed about 7 years ago)
> >
> > =========
> > Capable() checks were added to these netlink-related places listed below
> > in netfilter by another upstream commit:
> > 4b380c42f7d00a395feede754f0bc2292eebe6e5(committed about 4 years ago)
> >
> > In kernel v5.13:
> >     File_1: linux/net/netfilter/nfnetlink_cthelper.c
> >                        in line 424, line 623 and line 691
> >     File_2: linux/net/netfilter/nfnetlink_osf.c
> >                        in line 305 and line 351
>
> These subsystems depend on nfnetlink.
>
> nfnetlink_rcv() is called before passing the message to the
> corresponding backend, e.g. nfnetlink_osf.
>
> static void nfnetlink_rcv(struct sk_buff *skb)
> {
>         struct nlmsghdr *nlh = nlmsg_hdr(skb);
>
>         if (skb->len < NLMSG_HDRLEN ||
>             nlh->nlmsg_len < NLMSG_HDRLEN ||
>             skb->len < nlh->nlmsg_len)
>                 return;
>
>         if (!netlink_net_capable(skb, CAP_NET_ADMIN)) {
>                 netlink_ack(skb, nlh, -EPERM, NULL);
>                 return;
>         }
>         [...]
>
> which is calling netlink_net_capable().
>
> > But these checkers are still using bare capable instead of netlink_capable
> > calls. So this is likely to trigger the vulnerability described in the
> > CVE-2014-0181 without checking the desired permissions of the socket
> > opener. Now, shall we forward port the fix pattern from the patch of
> > CVE-2014-0181?
> >
> > We would like to contact you to confirm this problem.
>
> I think these capable() calls in nfnetlink_cthelper and nfnetlink_osf
> are dead code that can be removed. As I explained these subsystems
> stay behind nfnetlink.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ