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: <1546193f-ed07-9a10-d2b3-d1d28138e291@oracle.com>
Date:   Mon, 30 Apr 2018 09:46:51 -0700
From:   Shannon Nelson <shannon.nelson@...cle.com>
To:     Wenwen Wang <wang6495@....edu>
Cc:     Kangjie Lu <kjlu@....edu>, "David S. Miller" <davem@...emloft.net>,
        Florian Fainelli <f.fainelli@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        Russell King <rmk+kernel@...linux.org.uk>,
        Edward Cree <ecree@...arflare.com>,
        Inbar Karmy <inbark@...lanox.com>,
        Eugenia Emantayev <eugenia@...lanox.com>,
        Al Viro <viro@...iv.linux.org.uk>,
        Yury Norov <ynorov@...iumnetworks.com>,
        Vidya Sagar Ravipati <vidya.chowdary@...il.com>,
        Alan Brady <alan.brady@...el.com>,
        Stephen Hemminger <stephen@...workplumber.org>,
        "open list:NETWORKING [GENERAL]" <netdev@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ethtool: fix a potential missing-check bug

On 4/29/2018 6:31 PM, Wenwen Wang wrote:
> In ethtool_get_rxnfc(), the object "info" is firstly copied from
> user-space. If the FLOW_RSS flag is set in the member field flow_type of
> "info" (and cmd is ETHTOOL_GRXFH), info needs to be copied again from
> user-space because FLOW_RSS is newer and has new definition, as mentioned
> in the comment. However, given that the user data resides in user-space, a
> malicious user can race to change the data after the first copy. By doing
> so, the user can inject inconsistent data. For example, in the second
> copy, the FLOW_RSS flag could be cleared in the field flow_type of "info".
> In the following execution, "info" will be used in the function
> ops->get_rxnfc(). Such inconsistent data can potentially lead to unexpected
> information leakage since ops->get_rxnfc() will prepare various types of
> data according to flow_type, and the prepared data will be eventually
> copied to user-space. This inconsistent data may also cause undefined
> behaviors based on how ops->get_rxnfc() is implemented.
> 
> This patch re-verifies the flow_type field of "info" after the second copy.
> If the value is not as expected, an error code will be returned.
> 
> Signed-off-by: Wenwen Wang <wang6495@....edu>
> ---
>   net/core/ethtool.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index 03416e6..a121034 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -1032,6 +1032,8 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
>   		info_size = sizeof(info);
>   		if (copy_from_user(&info, useraddr, info_size))
>   			return -EFAULT;

You might add a comment here to explain why the second check; otherwise 
someone might come along later and remove this check as redundant code.

sln

> +		if (!(info.flow_type & FLOW_RSS))
> +			return -EINVAL;
>   	}
>   
>   	if (info.cmd == ETHTOOL_GRXCLSRLALL) {
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ