BSDSec

deadsimple BSD Security Advisories and Announcements

NetBSD Security Advisory 2022-002: Coredump credential reference count leak

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

		 NetBSD Security Advisory 2022-002
		 =================================

Topic:		Coredump credential reference count leak

Version:	NetBSD-current:		affected prior to 2022-09-10
		NetBSD 9.2:		affected
		NetBSD 8.2:		affected

Severity:	Malicious user may read from opened file descriptors by other
		processes.

Fixed:		NetBSD-current:		September 10, 2022
		NetBSD-9 branch:	September 10, 2022
		NetBSD-8 branch:	September 10, 2022

Please note that NetBSD releases prior to 8 are no longer supported.
It is recommended that all users upgrade to a supported release.

Abstract
========

The coredump handling code always leaks a reference to the dumped processes
cred structure. An attacker may cause the reference count to overflow,
leading to a use after free (UAF).

Solutions and Workarounds
=========================

Set the coredump resource limit to 0 to prevent coredumps in the system.

To apply a fixed version from a releng build, fetch a fitting kern-GENERIC.tgz
from nycdn.NetBSD.org and extract the fixed binaries:

cd /var/tmp
ftp https://nycdn.NetBSD.org/pub/NetBSD-daily/REL/BUILD/ARCH/binary/sets/kern-GENERIC.tgz
cd /
tar xzpf /var/tmp/kern-GENERIC.tgz

with the following replacements:
REL   = the release version you are using
BUILD = the source date of the build. 20220910 and later will fit
ARCH  = your system's architecture


The following instructions describe how to upgrade your kernel by
updating your source tree and rebuilding and installing a new version
of the kernel.

For all NetBSD versions, you need to obtain fixed kernel sources, rebuild
and install the new kernel, and reboot the system.

The fixed source may be obtained from the NetBSD CVS repository. The
following instructions briefly summarise how to upgrade your kernel.
In these instructions, replace:

	ARCH     with your architecture (from uname -m), and
	KERNCONF with the name of your kernel configuration file.

To update from CVS, re-build, and re-install the kernel:

	# cd src
	# cvs update -d -P sys/miscfs/procfs/procfs_vnops.c
	# ./build.sh kernel=KERNCONF
	# mv /netbsd /netbsd.old
	# cp sys/arch/ARCH/compile/obj/KERNCONF/netbsd /netbsd
	# shutdown -r now

For more information on how to do this, see:

	https://www.NetBSD.org/docs/guide/en/chap-kernel.html


Thanks To
=========

Chris J-D <chris@accessvector.net> for discovering, analyzing the problem
and proposing a fix.

Revision History
================

	2022-10-02	Initial release

More Information
================

Advisories may be updated as new information becomes available.
The most recent version of this advisory (PGP signed) can be found at

	https://cdn.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2022-002.txt.asc

Information about NetBSD and NetBSD security can be found at

	https://www.NetBSD.org/
	https://www.NetBSD.org/support/security/


Copyright 2022, The NetBSD Foundation, Inc.  All Rights Reserved.
Redistribution permitted only in full, unmodified form.

$Id: NetBSD-SA2022-002.txt,v 1.1 2022/10/02 14:02:28 christos Exp $
-----BEGIN PGP SIGNATURE-----

iQJQBAEBCAA6FiEEJxEzJivzXLUNT1BGiSYeF/XvSf8FAmM5mfUcHHNlY3VyaXR5
LW9mZmljZXJAbmV0YnNkLm9yZwAKCRCJJh4X9e9J/xrHD/0Wbq+Udq/u0cuF97kH
/3MOresRMPCTg8TOjvC88ONJOwCU/qh7txV/STIHD+HBOsLu47DbcFzKTJjIsiGQ
fTeeMIs3WH04J4+kEzJtmUxvRfp0Yvy2LmOnn1hWh9iUEOm+k4U8eWnOzo6PTlli
10mz8WaNRA/aMbUsPlL9dSn/c8InGVxJvSR1w1K8O+nox+E08QCymO/mO+V70K/E
VTlf9zQwZU02J2k2hChGHjBJKh/VvdG5He5pyTT9a9aTnSxwwZkdJE7+GuyLmhSg
D9rp5mJo+TAeY4kn5SAiByaullc+uwfg1dfr2D81Qp9rFIYCjWPYJpFrN0XTVhVk
j+eCWX0FSCD/qdUUDLp67coF2EgoDkKo8NxPoxE2AR6N9covcwAmi4E8CGsO4+Kl
WEAuaoSOQvdU/nBms8VH0BWYWzmVwq3sk2gHHXw88r1dNjhsJ/ojiyOWOt2yP6uE
gceCFY+qaTrAo5hGgcOLh9EzfDzSrq3f/8fFwLuZeeDVQsmVhg0ltRVi9eNIXr/2
qxp4RBPB7bINHQR7uT/9hyFXxp4+SsWSzau+9Z61Z6WXEA7i24jHXUvTtTTqSa/r
T+znbCJ8M07oU4TSG3dR4VmILwebHvW/zVZfsE8KzA/o5A30wSRkoRGIjULMd5iY
gmObL5NqCIwT81wHOoPk2Kz6oA==
=RXBd
-----END PGP SIGNATURE-----