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>] [day] [month] [year] [list]
Message-ID: <ZeCshnw9Ac1fd5pV@calendula>
Date: Thu, 29 Feb 2024 17:10:46 +0100
From: Pablo Neira Ayuso <pablo@...filter.org>
To: Vasiliy Kovalev <kovalev@...linux.org>
Cc: Alexander Ofitserov <oficerovas@...linux.org>,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	edumazet@...gle.com, laforge@...monks.org, davem@...emloft.net,
	kuba@...nel.org, pabeni@...hat.com, nickel@...linux.org,
	dutyrok@...linux.org, stable@...r.kernel.org
Subject: Re: [PATCH net] gtp: fix use-after-free and null-ptr-deref in
 gtp_newlink()

On Thu, Feb 29, 2024 at 11:37:28AM +0300, Vasiliy Kovalev wrote:
[...]
> This patch fixes another problem, but a similar one, since the sequence is
> incorrect when registering subsystems.
> 
> Initially, the registration sequence in the gtp module was as follows:
> 
> 1) rtnl_link_register();
> 
> 2) genl_register_family();
> 
> 3) register_pernet_subsys();
> 
> During debugging of the module, when starting the syzkaller reproducer, it
> turned out that after genl_register_family() (2),
> 
> without waiting for register_pernet_subsys()(3), the /.dumpit/  event is
> triggered, in which the data of the unregistered pernet subsystem is
> accessed.
> 
> That is, the bug was fixed by the commit
> 
> 136cfaca2256 ("gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()")[1]
> 
> and the registration sequence became as follows:
> 
> 1) rtnl_link_register();
> 
> 2) register_pernet_subsys();
> 
> 3) genl_register_family();
> 
> However, syzkaller has discovered another problem:
> 
> after registering rtnl_link_register, the .newlink event is triggered, in
> which the data of the unregistered pernet subsystem is accessed.
> 
> This problem is reproducible on current stable kernels and the latest
> upstream kernel 6.8-rc6, in which the patch 136cfaca2256 [1] is applied.
> 
> Therefore, the correct sequence should be as follows:
> 
> 1)register_pernet_subsys();
> 
> 2) rtnl_link_register();
> 
> 3) genl_register_family();
> 
> The proposed patch is developed on top of the commit changes [1], does not
> conflict with it and fixes the described bug.
>
> [1] https://lore.kernel.org/lkml/20240220160434.29bcaf43@kernel.org/T/#mb1f72c2ad57b7ea6d47333e8616beccf8bce0e23

Thanks for explaining, fix LGTM.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ