NetBSD Security Advisory 2005-003: F_CLOSEM local denial of service

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

NetBSD Security Advisory 2005-003
=================================

Topic: F_CLOSEM local denial of service

Version: NetBSD-current: source prior to January 12, 2005
NetBSD 2.1: not affected
NetBSD 2.0.2: not affected
NetBSD 2.0: affected
NetBSD 1.6.*: not affected

Severity: Local Denial-of-Service

Fixed: NetBSD-current: January 12, 2005
NetBSD-2-0 branch: March 16, 2005
(2.0.2 includes the fix)
NetBSD-2 branch: March 16, 2005
(2.1 includes the fix)

Abstract
========

A bug in the way the file descriptor table of a process is manipulated
can be triggered by calling the F_CLOSEM fnctl() with the parameter 0,
which means "close all opened file descriptors".

The result of the bug is that the kernel will loop endlessly,
effectively locking up the computer.

Any local user can trigger the bug.

Technical Details
=================

The F_CLOSEM fnctl() call takes a parameter and makes the kernel close
all file descriptors of the process whose number is greater or equal to
the parameter.

fd_lastfile in the process's descriptor table keeps track of the last file
descriptor index used by the process, and its value is maintained by
find_last_set(). A change in find_last_set() that made it return 0 and not
- -1 (like it used to) when no files were used caused an infinite loop in
the kernel, leading to local denial-of-service triggerable by any user.

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

There is no workaround for this issue. It is recommended that users of
affected NetBSD versions upgrade their kernel.

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

* NetBSD-current:

Systems running NetBSD-current dated from before 2005-01-12
should be upgraded to NetBSD-current dated 2005-01-13 or later.

The following files need to be updated from the
netbsd-current CVS branch (aka HEAD):
sys/kern/kern_descrip.c

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

# cd src
# cvs update -d -P sys/kern/kern_descrip.c
# ./build.sh kernel=GENERIC
# mv /netbsd /netbsd.old
# cp sys/arch/`machine`/compile/obj/GENERIC/netbsd /netbsd
# shutdown -r now

* NetBSD 2.0:

The binary distribution of NetBSD 2.0 is vulnerable.

NetBSD 2.1 includes the fix.

Systems running NetBSD 2.0 sources dated from before
2005-01-12 should be upgraded from NetBSD 2.0 sources dated
2005-01-13 or later.

The following files need to be updated from the
netbsd-2-0 CVS branch:
sys/kern/kern_descrip.c

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

# cd src
# cvs update -d -P -r netbsd-2-0 sys/kern/kern_descrip.c
# ./build.sh kernel=GENERIC
# mv /netbsd /netbsd.old
# cp sys/arch/`machine`/compile/obj/GENERIC/netbsd /netbsd
# shutdown -r now

Thanks To
=========

Brian Marcotte, for discovering and reporting the issue.

Greg Oster and Quentin Garnier, for analysis and fixes.

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

2005-10-31 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
ftp://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2005-003.tx...

Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.org/ and http://www.NetBSD.org/Security/.

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

$NetBSD: NetBSD-SA2005-003.txt,v 1.10 2005/10/31 19:11:45 gendalia Exp $

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (NetBSD)

iQCVAwUBQ2fKRj5Ru2/4N2IFAQKyJQP/cF9a8IM4ayqS2nNv0HPgL4uPvbmnHPDW
F76FTxFDfrImmkMNrdIBaj/1B/LS41+iMWTJJFGWNkqZjzXKVLuD7/rLDKGjI1Aa
WfmS7gHoZcI5p5A0x+RFtOM399sQX2/cC5a0hcGamKncBChKMNEdn3u//q/HC+4e
rpQReunJrFU=
=SfoJ
-----END PGP SIGNATURE-----

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
New Developers, Jan Schaumann, (Sat Feb 1, 1:58 pm)
Summer of Code projects selected, Jan Schaumann, (Mon Apr 21, 5:43 pm)
Donations for the new CVS server, Christos Zoulas, (Tue Jul 22, 1:27 pm)
The new CVS server for NetBSD, Luke Mewburn, (Tue Feb 10, 8:17 pm)
Quarterly Status Report: October - December 2004, Jan Schaumann, (Tue Jan 11, 1:28 pm)
Urgent Network Maintenance scheduled for 10/14/2007 (fwd), Hubert Feyrer, (Sun Oct 14, 9:23 am)
AnonCVS outage 2005-05-21, Thor Lancelot Simon, (Fri May 20, 1:06 pm)
NetBSD Security Advisory 2005-003: F_CLOSEM local denial of ..., NetBSD Security-Officer, (Mon Nov 7, 6:55 pm)
Announcing NetBSD 4.0.1, Manuel Bouyer, (Tue Oct 14, 5:36 pm)
NetBSD Security Advisory 2009-012: SHA2 implementation poten..., NetBSD Security Officer, (Tue Jul 28, 5:52 pm)
The pkgsrc-2006Q1 branch, Alistair Crooks, (Fri Mar 31, 6:43 am)
(unknown), Herb Peyerl, (Mon May 1, 3:30 pm)
End of life for 3.x, Soren Jacobsen, (Sat May 30, 2:56 am)
NetBSD Security Advisory 2006-023: OpenSSL RSA Signature For..., NetBSD Security-Officer, (Thu Sep 21, 5:46 pm)