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: Tue, 21 Nov 2023 22:36:08 +0800
From: shaozhengchao <shaozhengchao@...wei.com>
To: Hangbin Liu <liuhangbin@...il.com>
CC: <netdev@...r.kernel.org>, <davem@...emloft.net>, <dsahern@...nel.org>,
	<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
	<weiyongjun1@...wei.com>, <yuehaibing@...wei.com>
Subject: Re: [PATCH net] ipv4: igmp: fix refcnt uaf issue when receiving igmp
 query packet



On 2023/11/21 10:56, Hangbin Liu wrote:
> Hi Zhengchao,
> On Tue, Nov 21, 2023 at 10:05:58AM +0800, Zhengchao Shao wrote:
>> ---
>>   net/ipv4/igmp.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
>> index 76c3ea75b8dd..f217581904d6 100644
>> --- a/net/ipv4/igmp.c
>> +++ b/net/ipv4/igmp.c
>> @@ -1044,6 +1044,8 @@ static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
>>   	for_each_pmc_rcu(in_dev, im) {
>>   		int changed;
>>   
>> +		if (!netif_running(im->interface->dev))
>> +			continue;
> 
> I haven't checked this part for a long time. What's the difference of in_dev->dev
> and im->interface->dev? I though they are the same, no?
> 
> If they are the same, should we stop processing the query earlier? e.g.
> 
> diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
> index 76c3ea75b8dd..f4e1d229c9aa 100644
> --- a/net/ipv4/igmp.c
> +++ b/net/ipv4/igmp.c
> @@ -1082,6 +1082,9 @@ int igmp_rcv(struct sk_buff *skb)
>                          goto drop;
>          }
> 
> +       if (!netif_running(dev))
> +               goto drop;
> +
>          in_dev = __in_dev_get_rcu(dev);
>          if (!in_dev)
>                  goto drop;
> 
> 
> BTW, does IPv6 MLD has this issue?
I also think mld has the same issue.

Thread A 				Thread B
icmpv6_rcv				br_dev_stop
   igmp6_event_query			  br_multicast_leave_snoopers
     start mc_query_work		            ipv6_dev_mc_dec
       Thread C				      __ipv6_dev_mc_dec
	mld_query_work				mutex_lock
	  ...				        igmp6_group_dropped//r=1
	  ...					mutex_unlock
	  ...					ma_put
	  ...					  refcount_dec_...//r=0
	  mutex_lock                  		
	  __mld_query_work
             igmp6_group_queried
	      refcount_inc(&ma->mca_refcnt) //r increased from 0
	  mutex_lock
Check whether the value of mcs_uses is 0 will solve the issue.

also I think checking whether the device is still running in IGMP does
not solve the uaf issue, but reduces the probability of the issue. I
will try to use a lock to solve the IGMP refcnt uaf issue.

> 
> Thanks
> Hangbin
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ