[SECURITY-L] CAIS-Alerta: Vulnerabilidade local no 'exec' do FreeBSD

Daniela Regina Barbetti daniela em ccuec.unicamp.br
Ter Jan 29 14:27:53 -02 2002


----- Forwarded message from Centro de Atendimento a Incidentes de Seguranca <cais em cais.rnp.br> -----

From: Centro de Atendimento a Incidentes de Seguranca <cais em cais.rnp.br>
Subject: CAIS-Alerta: Vulnerabilidade local no 'exec' do FreeBSD
To: <rnp-alerta em cais.rnp.br>, <rnp-seg em cais.rnp.br>
Date: Tue, 29 Jan 2002 14:04:18 -0200 (EDT)

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


Prezados,

O CAIS esta' repassando o alerta FreeBSD-SA-02:08 que trata de uma
vulnerabilidade local existente no 'exec' que pode possibilitar acesso
local privilegiado. Todas as versoes de FreeBSD 4.x anteriores a
4.5-RELEASE sao afetadas pelo problema. A versao 4.4-STABLE anterior a
data de correcao tambem esta' vulneravel.

Recomenda-se fortemente que seja aplicada a devida correcao.

Atenciosamente,


################################################################
#   CENTRO DE ATENDIMENTO A INCIDENTES DE SEGURANCA / RNP      #
#                                                              #
# cais em cais.rnp.br     http://www.cais.rnp.br                  #
# Tel. 019-37873300    Fax. 019-37873301                       #
# Chave PGP disponivel em: http://www.cais.rnp.br/cais-pgp.key #
################################################################


=============================================================================
FreeBSD-SA-02:08                                            Security
Advisory
                                                                FreeBSD,
Inc.

Topic:          race condition during exec may allow local root compromise

Category:       core
Module:         kernel
Announced:      2002-01-24
Credits:        Logan Gabriel <gersh em sonn.com>,
                Robert Watson <rwatson em FreeBSD.org>,
                Dag-Erling Smørgrav <des em FreeBSD.org>
Affects:        All released versions of FreeBSD 4.x prior to 4.5-RELEASE.
                FreeBSD 4.4-STABLE prior to the correction date.
Corrected:      2002-01-22 17:22:59 UTC (4-STABLE, RELENG_4)
                2002-01-23 23:05:00 UTC (4.4-RELEASE-p4, RELENG_4_4)
                2002-01-23 23:05:53 UTC (4.3-RELEASE-p24, RELENG_4_3)
FreeBSD only:   NO

I.   Background

When a process is started from a set-user-ID or set-group-ID binary,
it is marked so that attempts to attach to it with debugging hooks
fail.  To allow such attachments would allow a user to subvert the
process and gain elevated privileges.

II.  Problem Description

A race condition exists in the FreeBSD exec system call
implementation.  It is possible for a user to attach a debugger to a
process while it is exec'ing, but before the kernel has determined
that the process is set-user-ID or set-group-ID.

All versions of FreeBSD 4.x prior to FreeBSD 4.5-RELEASE are
vulnerable to this problem.  The problem has been corrected by marking
processes that have started but not yet completed exec with an
`in-exec' state.  Attempts to debug a process in the in-exec state
will fail.

III. Impact

Local users may be able to gain increased privileges on the local
system.

IV.  Workaround

None.  Do not allow untrusted users to gain access to the local
system.

V.   Solution

One of the following:

1) Upgrade your vulnerable FreeBSD system to 4.4-STABLE, or the
RELENG_4_3 or RELENG_4_4 security branch, dated after the respective
correction date.

2) To patch your present system:

a) Download the relevant patch from the following location:

[FreeBSD 4.4-STABLE, or RELENG_4_3 and RELENG_4_4 security branches]

ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:08/exec.patch
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:08/exec.patch.asc

[FreeBSD 4.3-RELEASE only]

ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:08/exec-43R.patch
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:08/exec-43R.patch.asc

b) Verify the detached PGP signature using your PGP utility.

c) Execute the following commands as root:

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

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

3) FreeBSD 4.4-RELEASE systems:

An experimental upgrade package is available for users who wish to
provide testing and feedback on the binary upgrade process.  This
package may be installed on FreeBSD 4.4-RELEASE systems only, and is
intended for use on systems for which source patching is not practical
or convenient.

If you use the upgrade package, feedback (positive or negative) to
security-officer em FreeBSD.org is requested so we can improve the
process for future advisories.

Since this vulnerability involves the FreeBSD kernel which is often
locally customized on installed systems, a universal binary upgrade
package is not feasible.  This package includes a patched version of
the GENERIC kernel which should be suitable for use on many systems.
Systems requiring a customized kernel must use an alternative
solution.

During the installation procedure, backup copies are made of the files
which are replaced by the package.  These backup copies will be
reinstalled if the package is removed, reverting the system to a
pre-patched state.

# fetch
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-02:08/security-patch-exec-02.08.tgz
# fetch
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-02:08/security-patch-exec-02.08.tgz.asc

Verify the detached PGP signature using your PGP utility.

# pkg_add security-patch-exec-02.08.tgz

The new kernel is named /kernel.GENERIC to avoid conflict with the
default kernel name (``/kernel'').  To cause the system to boot
automatically with the new kernel, add the following line to
/boot/loader.conf:

kernel="/kernel.GENERIC"

and reboot the system to load the new kernel.  The old kernel is still
available and can be manually loaded in the boot loader in case of
problems.

VI.  Correction details

The following list contains the $FreeBSD$ revision number of the
files that were corrected in the FreeBSD source.

Path                                                             Revision
  Branch

- -------------------------------------------------------------------------
src/sys/conf/newvers.sh
  RELENG_4_4                                                1.44.2.17.2.5
  RELENG_4_3                                               1.44.2.14.2.14
src/sys/kern/kern_exec.c
  RELENG_4                                                     1.107.2.13
  RELENG_4_4                                                1.107.2.8.2.1
  RELENG_4_3                                                1.107.2.5.2.2
src/sys/kern/sys_process.c
  RELENG_4                                                       1.51.2.3
  RELENG_4_4                                                 1.51.2.1.4.1
  RELENG_4_3                                                 1.51.2.1.2.1
src/sys/miscfs/procfs/procfs.h
  RELENG_4                                                       1.32.2.3
  RELENG_4_4                                                 1.32.2.2.2.1
  RELENG_4_3                                                 1.32.2.1.2.2
src/sys/miscfs/procfs/procfs_ctl.c
  RELENG_4                                                       1.20.2.2
  RELENG_4_4                                                 1.20.2.1.4.1
  RELENG_4_3                                                 1.20.2.1.2.1
src/sys/miscfs/procfs/procfs_dbregs.c
  RELENG_4                                                        1.4.2.3
  RELENG_4_4                                                  1.4.2.2.2.1
  RELENG_4_3                                                  1.4.2.1.2.1
src/sys/miscfs/procfs/procfs_fpregs.c
  RELENG_4                                                       1.11.2.3
  RELENG_4_4                                                 1.11.2.2.2.1
  RELENG_4_3                                                 1.11.2.1.2.1
src/sys/miscfs/procfs/procfs_mem.c
  RELENG_4                                                       1.46.2.3
  RELENG_4_4                                                 1.46.2.2.2.1
  RELENG_4_3                                                 1.46.2.1.2.2
src/sys/miscfs/procfs/procfs_regs.c
  RELENG_4                                                       1.10.2.3
  RELENG_4_4                                                 1.10.2.2.2.1
  RELENG_4_3                                                 1.10.2.1.2.1
src/sys/miscfs/procfs/procfs_status.c
  RELENG_4                                                       1.20.2.4
  RELENG_4_4                                                 1.20.2.3.4.1
  RELENG_4_3                                                 1.20.2.3.2.1
src/sys/miscfs/procfs/procfs_vnops.c
  RELENG_4                                                       1.76.2.7
  RELENG_4_4                                                 1.76.2.5.2.1
  RELENG_4_3                                                 1.76.2.3.2.2
src/sys/sys/proc.h
  RELENG_4                                                       1.99.2.6
  RELENG_4_4                                                 1.99.2.5.4.1
  RELENG_4_3                                                 1.99.2.5.2.1

- -------------------------------------------------------------------------

VII. References

<URL:ftp://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2002-001.txt.asc>



- ------------ Output from pgp ------------
Signature by unknown keyid: 0x73D288A5





-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
Charset: noconv

iQCVAwUBPFbIH+kli63F4U8VAQHVugQAjxHa7FNenlRmibHxJrOZW4pNxG9HmiSY
9cxRRuv7SmTtk0IL6Z03ILfTn5+c6AGW9xitb+Ff67qOeAJk6wjuTrPTf/7LQ563
wzEMu7DPewTd6NBQDtn1gGV8hCpdRFUsJEg3TGdNLxctjdI2cyC/VbCPHImCgu8S
yknCZ1HaFh8=
=1sgc
-----END PGP SIGNATURE-----



----- End forwarded message -----




Mais detalhes sobre a lista de discussão SECURITY-L