Date: Wed, 15 Sep 1999 23:25:03 -0600 (MDT)
From: FreeBSD Security Officer <security-officer@FreeBSD.ORG.>
To: undisclosed-recipients: ;
Subject: FreeBSD Security Advisory: FreeBSD-SA-99:04.core
-----BEGIN PGP SIGNED MESSAGE-----
FreeBSD-SA-99:04 Security Advisory
FreeBSD, Inc.
Topic: Coredumps and symbolic links
Category: core
Module: kernel
Announced: 1999-09-15
Affects: FreeBSD 3.2 (and earlier)
FreeBSD-current before the correction date.
FreeBSD 3.2-stable before the correction date.
FreeBSD 2.2.8-stable before the correction date.
Corrected: FreeBSD-3.3 RELEASE
FreeBSD-current as of 1999/08/26
FreeBSD-3.2-stable as of 1999/08/26
FreeBSD-2.2.8-stable as of 1999/08/29
The FreeBSD-3.3-RC series of releases are not affected.
FreeBSD only: NO
Patches: ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-99:04/
I. Background
As a diagnostic aid to help programmers find bugs in their programs,
the system creates core files when an illegal instruction or other
fatal error happens. A flaw in the kernel allowed it to follow
symbolic links when creating core files.
II. Problem Description
The fts library functions had a flaw in them where which would lead to
a core dump when periodic ran the security checking scripts (or other
scripts which traverse trees that can be controlled by users).
periodic(3) should limit core size to zero to disable core dumps while
it is executing commands, but does not do so. In addition, the kernel
should not follow symbolic links.
All three of these problems caused a situation where it was possible
for an attacker could create or overwrite an arbitrary file on the
system with a moderate degree of controll of its contents to cause a
problem.
III. Impact
Local users could gain root access.
IV. Workaround
One can workaround this problem by preventing core dumps for periodic.
This solution is less than completely satisfying, since it only plugs
the known exploit hole. None the less, this may provide a short term
stopgap solution until a new kernel and/or userland can be installed.
# mv /usr/sbin/periodic /usr/sbin/periodic.bin
# cat > /usr/sbin/periodic
#!/bin/sh
ulimit -c 0
/usr/sbin/periodic.bin $*
^D
# chmod 555 /usr/sbin/periodic
Another alternative would be to update the fts routines to a version
newer than 1999/09/02 (for -current or 3.3-stable) or 1999/09/04 (for
2.2.8-stable). However, this requires that you rebuild via "make
world" to take effect.
V. Solution
Please note: there is a separate advisory describing the fts problem
and solution. Please see FreeBSD-SA-99:05.fts.asc in the advisories
directory for additional information about the fts patch.
Apply the following patches to your kernel. They will disallow
following symbolic links when creating core files. This will stop
this attack, and all similar such attacks.
Here's the patch for freebsd-current:
kern/LINK/vfs_syscalls.c Wed Aug 4 12:44:30 1999
--- kern/vfs_syscalls.c Sat Aug 28 10:48:51 1999
***************
694,699 ****
--- 694,701 ----
flags = FFLAGS(uap->flags);
if ((flags & FREAD + FWRITE) == 0)
return (EINVAL);
+ if (flags & O_NOFOLLOW)
+ flags &= ~O_NOFOLLOW;
error = falloc(p, &nfp, &indx);
if (error)
return (error);
FreeBSD, Inc.
Web Site: http://www.freebsd.org/
Confidential contacts: [email protected]
Security notifications: [email protected]
Security public discussion: [email protected]
PGP Key: ftp://ftp.freebsd.org/pub/FreeBSD/CERT/public_key.asc
Notice: Any patches in this document may not apply cleanly due to
modifications caused by digital signature or mailer software.
Please reference the URL listed at the top of this document
for original copies of all patches if necessary.
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv
Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface
iQCVAwUBN+B44VUuHi5z0oilAQHkwwP9HeLkRJY/iXIYXUx8/A38EAxM/TAqxoiI
ym7ZyktNtuCbum8ovCIfmkpnafaFyXmVSDhCX77LbIy+1clEBnelyueJ9TbKpBgU
KWjTWmfj/7QsU2Ya/f7FK80ee8y7GjTTYxilnxxzTmM8ihHzFXrPHudoO4lTR7Op
2VII3pQVxOM=
=bJXX
-----END PGP SIGNATURE-----
This is the moderated mailing list freebsd-announce.
The list contains announcements of new FreeBSD capabilities,
important events and project milestones.
See also the FreeBSD Web pages at http://www.freebsd.org
To Unsubscribe: send mail to [email protected]
with "unsubscribe freebsd-announce" in the body of the message