[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UNIRAS Brief - 558/03 - FreeBSD Security Advisory:kernel memory disclosure via procfs



 
-----BEGIN PGP SIGNED MESSAGE-----

- ----------------------------------------------------------------------------------
   UNIRAS (UK Govt CERT) Briefing Notice - 558/03 dated 06.10.03  Time: 11:40
 UNIRAS is part of NISCC(National Infrastructure Security Co-ordination Centre)
- ---------------------------------------------------------------------------------- 
  UNIRAS material is also available from its website at www.uniras.gov.uk and
         Information about NISCC is available from www.niscc.gov.uk
- ----------------------------------------------------------------------------------

Title
=====

FreeBSD Security Advisory:kernel memory disclosure via procfs

Detail
====== 

The procfs and linprocfs implementations use uiomove(9) and the
related `struct uio' in order to fulfill read and write requests.
Several cases were identified where members of `struct uio' were not
properly validated before being used.  In particular, the `uio_offset'
member may be negative or extremely large, and was used to compute the
region of kernel memory to be returned to the user.


                 ESB-2003.0702 -- FreeBSD-SA-03:17.procfs
                    kernel memory disclosure via procfs
                              06 October 2003

Product:                process file system
Publisher:              FreeBSD
Operating System:       FreeBSD
Impact:                 Denial of Service
                        Reduced Security
Access Required:        Existing Account

- --------------------------BEGIN INCLUDED TEXT--------------------

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

=============================================================================
FreeBSD-SA-03:17.procfs                                     Security Advisory
                                                          The FreeBSD Project

Topic:          kernel memory disclosure via procfs

Category:       core
Module:         sys
Announced:      2003-10-03
Credits:        Joost Pol <joost@xxxxxxx>
Affects:        All FreeBSD releases
Corrected:      2003-10-03 12:03:50 UTC (RELENG_4, 4.9-RC)
                2003-10-03 13:02:17 UTC (RELENG_5_1, 5.1-RELEASE-p9)
                2003-10-03 13:02:49 UTC (RELENG_5_0, 5.0-RELEASE-p17)
                2003-10-03 13:03:44 UTC (RELENG_4_8, 4.8-RELEASE-p12)
                2003-10-03 13:04:19 UTC (RELENG_4_7, 4.7-RELEASE-p22)
                2003-10-03 13:05:05 UTC (RELENG_4_6, 4.6-RELEASE-p25)
                2003-10-03 13:05:44 UTC (RELENG_4_5, 4.5-RELEASE-p36)
                2003-10-03 13:06:32 UTC (RELENG_4_4, 4.4-RELEASE-p46)
                2003-10-03 13:07:37 UTC (RELENG_4_3, 4.3-RELEASE-p42)
FreeBSD only:   YES

For general information regarding FreeBSD Security Advisories,
including descriptions of the fields above, security branches, and the
following sections, please visit
<URL:http://www.freebsd.org/security/>.

I.   Background

The process file system, procfs(5), implements a view of the system
process table inside the file system.  It is normally mounted on
/proc, and is required for the complete operation of programs such as
ps(1) and w(1).

The Linux process file system, linprocfs(5), emulates a subset of
Linux's process file system and is required for the complete operation
of some Linux binaries.

II.  Problem Description

The procfs and linprocfs implementations use uiomove(9) and the
related `struct uio' in order to fulfill read and write requests.
Several cases were identified where members of `struct uio' were not
properly validated before being used.  In particular, the `uio_offset'
member may be negative or extremely large, and was used to compute the
region of kernel memory to be returned to the user.

III. Impact

A malicious local user could arrange to use a negative or extremely
large offset when reading from a procfs ``file'', causing a system
crash, or causing the kernel to return a large portion of kernel
memory.  Such memory might contain sensitive information, such as
portions of the file cache or terminal buffers.  This information
might be directly useful, or it might be leveraged to obtain elevated
privileges in some way.  For example, a terminal buffer might include
a user-entered password.

IV.  Workaround

Unmount the procfs and linprocfs filesystems if they are mounted.
Execute the following command as root:

  umount -a -t procfs,linprocfs

Also, remove or comment out any lines in fstab(5) that reference
`procfs' or `linprocfs', so that they will not be re-mounted at next
reboot.

V.   Solution

1) Upgrade your vulnerable system to 4-STABLE, or to the
RELENG_5_1, RELENG_4_8, or RELENG_4_7 security branch dated
after the correction date.

2) To patch your present system:

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

[FreeBSD 4.3]
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:17/procfs43.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:17/procfs43.patch.asc

[FreeBSD 4.4 and later 4.x]
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:17/procfs4x.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:17/procfs4x.patch.asc

[FreeBSD 5.0]
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:17/procfs50.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:17/procfs50.patch.asc

[FreeBSD 5.1]
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:17/procfs51.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:17/procfs51.patch.asc

b) Apply the patch.

# cd /usr/src
# patch < /path/to/patch

c) Recompile your kernel as described in
<URL:http://www.freebsd.org/handbook/kernelconfig.html>
and reboot the system.

VI.  Correction details

The following list contains the revision numbers of each file that was
corrected in FreeBSD.

Branch                                                           Revision
  Path
- - -------------------------------------------------------------------------
RELENG_4
  src/sys/i386/linux/linprocfs/linprocfs_misc.c                   1.3.2.9
  src/sys/kern/kern_subr.c                                       1.31.2.3
  src/sys/miscfs/procfs/procfs_dbregs.c                           1.4.2.4
  src/sys/miscfs/procfs/procfs_fpregs.c                          1.11.2.4
  src/sys/miscfs/procfs/procfs_regs.c                            1.10.2.4
  src/sys/miscfs/procfs/procfs_rlimit.c                           1.5.2.1
  src/sys/miscfs/procfs/procfs_status.c                          1.20.2.5
  src/sys/sys/uio.h                                              1.11.2.2
RELENG_5_1
  src/UPDATING                                                 1.251.2.11
  src/sys/conf/newvers.sh                                       1.50.2.11
  src/sys/fs/procfs/procfs_dbregs.c                              1.22.2.1
  src/sys/fs/procfs/procfs_fpregs.c                              1.28.2.1
  src/sys/fs/procfs/procfs_regs.c                                1.27.2.1
  src/sys/fs/pseudofs/pseudofs_vnops.c                           1.35.2.1
  src/sys/kern/kern_subr.c                                       1.74.2.1
  src/sys/sys/uio.h                                              1.27.2.1
RELENG_5_0
  src/UPDATING                                                 1.229.2.23
  src/sys/conf/newvers.sh                                       1.48.2.18
  src/sys/fs/procfs/procfs_dbregs.c                              1.21.2.1
  src/sys/fs/procfs/procfs_fpregs.c                              1.27.2.1
  src/sys/fs/procfs/procfs_regs.c                                1.26.2.1
  src/sys/fs/pseudofs/pseudofs_vnops.c                           1.32.2.1
  src/sys/kern/kern_subr.c                                       1.63.2.1
  src/sys/sys/uio.h                                              1.23.2.1
RELENG_4_8
  src/UPDATING                                             1.73.2.80.2.14
  src/sys/conf/newvers.sh                                  1.44.2.29.2.13
  src/sys/i386/linux/linprocfs/linprocfs_misc.c              1.3.2.8.10.1
  src/sys/kern/kern_subr.c                                   1.31.2.2.6.1
  src/sys/miscfs/procfs/procfs_dbregs.c                       1.4.2.3.8.1
  src/sys/miscfs/procfs/procfs_fpregs.c                      1.11.2.3.8.1
  src/sys/miscfs/procfs/procfs_regs.c                        1.10.2.3.8.1
  src/sys/miscfs/procfs/procfs_rlimit.c                          1.5.14.1
  src/sys/miscfs/procfs/procfs_status.c                      1.20.2.4.8.1
  src/sys/sys/uio.h                                          1.11.2.1.8.1
RELENG_4_7
  src/UPDATING                                             1.73.2.74.2.25
  src/sys/conf/newvers.sh                                  1.44.2.26.2.24
  src/sys/i386/linux/linprocfs/linprocfs_misc.c               1.3.2.8.8.1
  src/sys/kern/kern_subr.c                                   1.31.2.2.4.1
  src/sys/miscfs/procfs/procfs_dbregs.c                       1.4.2.3.6.1
  src/sys/miscfs/procfs/procfs_fpregs.c                      1.11.2.3.6.1
  src/sys/miscfs/procfs/procfs_regs.c                        1.10.2.3.6.1
  src/sys/miscfs/procfs/procfs_rlimit.c                          1.5.12.1
  src/sys/miscfs/procfs/procfs_status.c                      1.20.2.4.6.1
  src/sys/sys/uio.h                                          1.11.2.1.6.1
RELENG_4_6
  src/UPDATING                                             1.73.2.68.2.54
  src/sys/conf/newvers.sh                                  1.44.2.23.2.42
  src/sys/i386/linux/linprocfs/linprocfs_misc.c               1.3.2.8.6.1
  src/sys/kern/kern_subr.c                                   1.31.2.2.2.1
  src/sys/miscfs/procfs/procfs_dbregs.c                       1.4.2.3.4.1
  src/sys/miscfs/procfs/procfs_fpregs.c                      1.11.2.3.4.1
  src/sys/miscfs/procfs/procfs_regs.c                        1.10.2.3.4.1
  src/sys/miscfs/procfs/procfs_rlimit.c                          1.5.10.1
  src/sys/miscfs/procfs/procfs_status.c                      1.20.2.4.4.1
  src/sys/sys/uio.h                                          1.11.2.1.4.1
RELENG_4_5
  src/UPDATING                                             1.73.2.50.2.53
  src/sys/conf/newvers.sh                                  1.44.2.20.2.37
  src/sys/i386/linux/linprocfs/linprocfs_misc.c               1.3.2.8.4.1
  src/sys/kern/kern_subr.c                                   1.31.2.1.2.1
  src/sys/miscfs/procfs/procfs_dbregs.c                       1.4.2.3.2.1
  src/sys/miscfs/procfs/procfs_fpregs.c                      1.11.2.3.2.1
  src/sys/miscfs/procfs/procfs_regs.c                        1.10.2.3.2.1
  src/sys/miscfs/procfs/procfs_rlimit.c                           1.5.8.1
  src/sys/miscfs/procfs/procfs_status.c                      1.20.2.4.2.1
  src/sys/sys/uio.h                                          1.11.2.1.2.1
RELENG_4_4
  src/UPDATING                                             1.73.2.43.2.54
  src/sys/conf/newvers.sh                                  1.44.2.17.2.45
  src/sys/i386/linux/linprocfs/linprocfs_misc.c               1.3.2.8.2.1
  src/sys/kern/kern_subr.c                                       1.31.6.1
  src/sys/miscfs/procfs/procfs_dbregs.c                       1.4.2.2.2.2
  src/sys/miscfs/procfs/procfs_fpregs.c                      1.11.2.2.2.2
  src/sys/miscfs/procfs/procfs_regs.c                        1.10.2.2.2.2
  src/sys/miscfs/procfs/procfs_rlimit.c                           1.5.6.1
  src/sys/miscfs/procfs/procfs_status.c                      1.20.2.3.4.2
  src/sys/sys/uio.h                                              1.11.6.1
RELENG_4_3
  src/UPDATING                                             1.73.2.28.2.41
  src/sys/conf/newvers.sh                                  1.44.2.14.2.31
  src/sys/i386/linux/linprocfs/linprocfs_misc.c               1.3.2.5.2.1
  src/sys/kern/kern_subr.c                                       1.31.4.1
  src/sys/miscfs/procfs/procfs_dbregs.c                       1.4.2.1.2.2
  src/sys/miscfs/procfs/procfs_fpregs.c                      1.11.2.1.2.2
  src/sys/miscfs/procfs/procfs_regs.c                        1.10.2.1.2.2
  src/sys/miscfs/procfs/procfs_rlimit.c                           1.5.4.1
  src/sys/miscfs/procfs/procfs_status.c                      1.20.2.3.2.2
  src/sys/sys/uio.h                                              1.11.4.1
- - -------------------------------------------------------------------------

VII. References

<URL:http://www.pine.nl/press/pine-cert-20030902.txt>
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQE/fYXyFdaIBMps37IRArbkAJ4qv/N215x61BW2NTyl6e4WY/DGLACgirQd
evgz6IOFh0L8fLRBHjbKO4A=
=Np7P
- -----END PGP SIGNATURE-----


For additional information or assistance, please contact the HELP Desk by 
telephone or Not Protectively Marked information may be sent via EMail to:
uniras@xxxxxxxxxxxx

Office Hours:
Mon - Fri: 08:30 - 17:00 Hrs
Tel: +44 (0) 20 7821 1330 Ext 4511
Fax: +44 (0) 20 7821 1686

Outside of Office Hours:
On Call Duty Officer:
Tel: +44 (0) 20 7821 1330 and follow the prompts

- ----------------------------------------------------------------------------------
UNIRAS wishes to acknowledge the contributions of FreeBSD for the information
contained in this Briefing. 
- ----------------------------------------------------------------------------------
This Briefing contains the information released by the original author. Some 
of the information may have changed since it was released. If the vulnerability 
affects you, it may be prudent to retrieve the advisory from the canonical site 
to ensure that you receive the most current information concerning that problem.

Reference to any specific commercial product, process, or service by trade 
name, trademark manufacturer, or otherwise, does not constitute or imply 
its endorsement, recommendation, or favouring by UNIRAS or NISCC.  The views 
and opinions of authors expressed within this notice shall not be used for 
advertising or product endorsement purposes.

Neither UNIRAS or NISCC shall also accept responsibility for any errors 
or omissions contained within this briefing notice. In particular, they shall 
not be liable for any loss or damage whatsoever, arising from or in connection 
with the usage of information contained within this notice.

UNIRAS is a member of the Forum of Incident Response and Security Teams (FIRST) 
and has contacts with other international Incident Response Teams (IRTs) in 
order to foster cooperation and coordination in incident prevention, to prompt 
rapid reaction to incidents, and to promote information sharing amongst its 
members and the community at large. 
- ----------------------------------------------------------------------------------
<End of UNIRAS Briefing>
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQCVAwUBP4FEf4pao72zK539AQHDAgQAoI6vJJBkc6QrDTqJuXVcW/CgvinKsOPb
S2gkUx6VS+9+44zpJ6rFxdYsNXWLVT+tk8ba3LAQJRoCoYpMChgZBCI84tUSe3vn
KaUBb7gc4iq0CsORtOt55ECNHk1D2dUy548Z5hBtSvW/Tm2aZdskHdDMAnwt8CLX
fGnPTzupJX0=
=a0ml
-----END PGP SIGNATURE-----