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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 1 Apr 2022 11:35:28 -0700
From:   Jeff Johnson <quic_jjohnson@...cinc.com>
To:     Lee Jones <lee.jones@...aro.org>
CC:     <linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>,
        Johannes Berg <johannes@...solutions.net>,
        "David S. Miller" <davem@...emloft.net>,
        "Jakub Kicinski" <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        <linux-wireless@...r.kernel.org>, <netdev@...r.kernel.org>
Subject: Re: [PATCH 1/1] nl80211: Prevent out-of-bounds read when processing
 NL80211_ATTR_REG_ALPHA2

On 4/1/2022 3:50 AM, Lee Jones wrote:
> Checks are presently in place in validate_nla() to ensure strings
> greater than 2 are not passed in by the user which could potentially
> cause issues.
> 
> However, there is nothing to prevent userspace from only providing a
> single (1) Byte as the data length parameter via nla_put().  If this
> were to happen, it would cause an OOB read in regulatory_hint_user(),
> since it makes assumptions that alpha2[0] and alpha2[1] will always be
> accessible.
> 
> Add an additional check, to ensure enough data has been allocated to
> hold both Bytes.
> 
> Cc: <stable@...r.kernel.org>
> Cc: Johannes Berg <johannes@...solutions.net>
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: Paolo Abeni <pabeni@...hat.com>
> Cc: linux-wireless@...r.kernel.org
> Cc: netdev@...r.kernel.org
> Signed-off-by: Lee Jones <lee.jones@...aro.org>
> ---
>   net/wireless/nl80211.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index ee1c2b6b69711..80a516033db36 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -7536,6 +7536,10 @@ static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info)
>   		if (!info->attrs[NL80211_ATTR_REG_ALPHA2])
>   			return -EINVAL;
>   
> +		if (nla_len(info->attrs[NL80211_ATTR_REG_ALPHA2]) !=
> +		    nl80211_policy[NL80211_ATTR_REG_ALPHA2].len)
> +			return -EINVAL;
> +
>   		data = nla_data(info->attrs[NL80211_ATTR_REG_ALPHA2]);
>   		return regulatory_hint_user(data, user_reg_hint_type);
>   	case NL80211_USER_REG_HINT_INDOOR:

LGTM

doesn't nl80211_set_reg() also have this issue?
	alpha2 = nla_data(info->attrs[NL80211_ATTR_REG_ALPHA2]);
[...]
	rd->alpha2[0] = alpha2[0];
	rd->alpha2[1] = alpha2[1];

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ