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

===========================================================================
             AUSCERT External Security Bulletin Redistribution

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

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

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@pine.nl>
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-----

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content. The decision to follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author's website to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

        http://www.auscert.org.au/render.html?cid=1980

If you believe that your computer system has been compromised or attacked in 
any way, we encourage you to let us know by completing the secure National IT 
Incident Reporting Form at:

        http://www.auscert.org.au/render.html?it=3192

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 7031
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
                AusCERT personnel answer during Queensland business 
                hours which are GMT+10:00 (AEST).  On call after hours 
                for member emergencies only.
-----BEGIN PGP SIGNATURE-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQCVAwUBP4CwBSh9+71yA2DNAQFc0wP+K2ZyV6LHVbEda8aGTV+bs9zgTc0B5dEP
5Bpj9dp5iGkeNWty/ZcF4+JkNefWfxqK29VuOIDQZ9jzJ+kAfqLFs1otYqgVE0Sb
ightZVUB13/F4ZVX8Y3WVW4xhRwxx1Uf58gm88/gWtptmJYaupTsDU2ZOIdi4Zuk
aVlj8/CzUTg=
=pvL/
-----END PGP SIGNATURE-----