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, 12 Mar 2021 22:47:53 +0800 (GMT+08:00)
From:   lyl2019@...l.ustc.edu.cn
To:     "Tom Parkin" <tparkin@...alix.com>
Cc:     paulus@...ba.org, davem@...emloft.net, linux-ppp@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: Re: [BUG] net/ppp: A use after free in ppp_unregister_channe




> -----原始邮件-----
> 发件人: "Tom Parkin" <tparkin@...alix.com>
> 发送时间: 2021-03-12 18:12:58 (星期五)
> 收件人: lyl2019@...l.ustc.edu.cn
> 抄送: paulus@...ba.org, davem@...emloft.net, linux-ppp@...r.kernel.org, netdev@...r.kernel.org, linux-kernel@...r.kernel.org
> 主题: Re: [BUG] net/ppp: A use after free in ppp_unregister_channe
> 
> Thanks for the report!
> 
> On  Thu, Mar 11, 2021 at 20:34:44 +0800, lyl2019@...l.ustc.edu.cn wrote:
> > File: drivers/net/ppp/ppp_generic.c
> > 
> > In ppp_unregister_channel, pch could be freed in ppp_unbridge_channels()
> > but after that pch is still in use. Inside the function ppp_unbridge_channels,
> > if "pchbb == pch" is true and then pch will be freed.
> 
> Do you have a way to reproduce a use-after-free scenario?
> 
> From static analysis I'm not sure how pch would be freed in
> ppp_unbridge_channels when called via. ppp_unregister_channel.
> 
> In theory (at least!) the caller of ppp_register_net_channel holds 
> a reference on struct channel which ppp_unregister_channel drops.
> 
> Each channel in a bridged pair holds a reference on the other.
> 
> Hence on return from ppp_unbridge_channels, the channel should not have
> been freed (in this code path) because the ppp_register_net_channel
> reference has not yet been dropped.
> 
> Maybe there is an issue with the reference counting or a race of some
> sort?
> 
> > I checked the commit history and found that this problem is introduced from
> > 4cf476ced45d7 ("ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls").
> > 
> > I have no idea about how to generate a suitable patch, sorry.

This issue was reported by a path-sensitive static analyzer developed by our Lab,
thus i have not a crash or bug log.

As the return type of ppp_unbridge_channels() is a int, can we return a value to
inform caller that the channel is freed?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ