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]
Message-ID: <e23f7bec-7675-20f7-8ec9-822c6ac3339f@android.com>
Date:   Fri, 24 Jul 2020 14:45:20 -0700
From:   Mark Salyzyn <salyzyn@...roid.com>
To:     Jacob Keller <jacob.e.keller@...el.com>,
        Eric Dumazet <eric.dumazet@...il.com>,
        linux-kernel@...r.kernel.org
Cc:     kernel-team@...roid.com, netdev@...r.kernel.org,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, Thomas Graf <tgraf@...g.ch>
Subject: Re: [PATCH] netlink: add buffer boundary checking

On 7/24/20 2:14 PM, Jacob Keller wrote:
>
> On 7/23/2020 12:35 PM, Eric Dumazet wrote:
>> On 7/23/20 11:21 AM, Mark Salyzyn wrote:
>>> Many of the nla_get_* inlines fail to check attribute's length before
>>> copying the content resulting in possible out-of-boundary accesses.
>>> Adjust the inlines to perform nla_len checking, for the most part
>>> using the nla_memcpy function to faciliate since these are not
>>> necessarily performance critical and do not need a likely fast path.
>>>
>>> Signed-off-by: Mark Salyzyn <salyzyn@...roid.com>
>>> Cc: netdev@...r.kernel.org
>>> Cc: linux-kernel@...r.kernel.org
>>> Cc: kernel-team@...roid.com
>>> Cc: "David S. Miller" <davem@...emloft.net>
>>> Cc: Jakub Kicinski <kuba@...nel.org>
>>> Cc: Thomas Graf <tgraf@...g.ch>
>>> Fixes: bfa83a9e03cf ("[NETLINK]: Type-safe netlink messages/attributes interface")
>>> ---
>>>   include/net/netlink.h | 66 +++++++++++++++++++++++++++++++++++--------
>>>   1 file changed, 54 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/include/net/netlink.h b/include/net/netlink.h
>>> index c0411f14fb53..11c0f153be7c 100644
>>> --- a/include/net/netlink.h
>>> +++ b/include/net/netlink.h
>>> @@ -1538,7 +1538,11 @@ static inline int nla_put_bitfield32(struct sk_buff *skb, int attrtype,
>>>    */
>>>   static inline u32 nla_get_u32(const struct nlattr *nla)
>>>   {
>>> -	return *(u32 *) nla_data(nla);
>>> +	u32 tmp;
>>> +
>>> +	nla_memcpy(&tmp, nla, sizeof(tmp));
>>> +
>>> +	return tmp;
>> I believe this will hide bugs, that syzbot was able to catch.
>>
>> Instead, you could perhaps introduce a CONFIG_DEBUG_NETLINK option,
>> and add a WARN_ON_ONCE(nla_len(nla) < sizeof(u32)) so that we can detect bugs in callers.
>>
>>
> I also think this is a better approach.

We (another engineer here) are looking into that and will get back to 
everyone.

Sincerely -- Mark Salyzyn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ