exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

ciac.i-037.freebsd.mmap.vuln

ciac.i-037.freebsd.mmap.vuln
Posted Sep 23, 1999

ciac.i-037.freebsd.mmap.vuln

systems | freebsd
SHA-256 | a4d04f1363c7f1f1f5a38c2210b5f9e54df5a87051b872b1826f9ddb9cc985b7

ciac.i-037.freebsd.mmap.vuln

Change Mirror Download

From ciac@tholia.llnl.gov Sat Mar 21 03:30:34 1998
From: CIAC Mail User <ciac@tholia.llnl.gov>
To: ciac-bulletin@tholia.llnl.gov
Date: Thu, 19 Mar 1998 13:02:11 -0800 (PST)
Subject: CIAC Bulletin I-037: FreeBSD mmap Vulnerability

[ For Public Release ]
-----BEGIN PGP SIGNED MESSAGE-----

__________________________________________________________

The U.S. Department of Energy
Computer Incident Advisory Capability
___ __ __ _ ___
/ | /_\ /
\___ __|__ / \ \___
__________________________________________________________

INFORMATION BULLETIN

FreeBSD mmap Vulnerability

March 16, 1998 23:00 GMT Number I-037
______________________________________________________________________________
PROBLEM: A vulnerability exists in the 4.4BSD VM system which allows
files to be "memory mapped".
PLATFORM: FreeBSD 2.2.*, FreeBSD-stable and FreeBSD-current before
1998/03/11.
DAMAGE: If exploited, unauthorized users may gain root access.
SOLUTION: Apply patches listed below.
______________________________________________________________________________
VULNERABILITY FreeBSD recommends that the patches be applied on affected
ASSESSMENT: systems.
______________________________________________________________________________

[ Start FreeBSD, Inc. Advisory ]

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

Topic: security compromise via mmap

Category: core
Module: kernel
Announced: 1998-03-12
Affects: FreeBSD 2.2.*, FreeBSD-stable and FreeBSD-current
before 1998/03/11 suffer from this problem.
Corrected: FreeBSD-current as of 1998/03/11
FreeBSD-stable as of 1998/03/11
FreeBSD only: no (also other 4.4BSD based systems may be affected)

Patches: ftp://ftp.freebsd.org/pub/CERT/patches/SA-98:02/

=============================================================================
IMPORTANT MESSAGE: The FreeBSD advisory archive has moved from
ftp://freebsd.org/pub/CERT to ftp://ftp.freebsd.org/pub/CERT
=============================================================================

I. Background

The 4.4BSD VM system allows files to be "memory mapped", which
causes the specified contents of a file to be made available
to a process via its address space. Manipulations of that file
can then be performed simply by manipulating memory, rather
than using filesystem I/O calls. This technique is used to
simplify code, speed up access to files, and provide interprocess
communication.

II. Problem Description

Due to a 4.4BSD VM system problem, it is possible to memory-map
a read-only descriptor to a character device in read-write
mode.

III. Impact

The hole can be used by members of group kmem to gain superuser
privileges. It also allows the superuser to lower the system
securelevel.

IV. Workaround

No workaround is known.

V. Solution


Apply one of the following patches, rebuild your kernel,
install it and reboot your system.

The patches below can be found on
ftp://ftp.freebsd.org/pub/CERT/patches/SA-98:02/


Patch for 3.0-current systems:

Index: vm_mmap.c
===================================================================
RCS file: /home/cvsup/freebsd/CVS/src/sys/vm/vm_mmap.c,v
retrieving revision 1.74
diff -u -r1.74 vm_mmap.c
--- vm_mmap.c 1998/03/07 21:37:01 1.74
+++ vm_mmap.c 1998/03/10 21:51:30
@@ -162,6 +162,7 @@
vm_prot_t prot, maxprot;
void *handle;
int flags, error;
+ int disablexworkaround;
off_t pos;

addr = (vm_offset_t) uap->addr;
@@ -252,6 +253,26 @@
pos = 0;
} else {
/*
+ * cdevs does not provide private mappings of any kind.
+ */
+ /*
+ * However, for XIG X server to continue to work,
+ * we should allow the superuser to do it anyway.
+ * We only allow it at securelevel < 1.
+ * (Because the XIG X server writes directly to video
+ * memory via /dev/mem, it should never work at any
+ * other securelevel.
+ * XXX this will have to go
+ */
+ if (securelevel >= 1)
+ disablexworkaround = 1;
+ else
+ disablexworkaround = suser(p->p_ucred,
+ &p->p_acflag);
+ if (vp->v_type == VCHR && disablexworkaround &&
+ (flags & (MAP_PRIVATE|MAP_COPY)))
+ return (EINVAL);
+ /*
* Ensure that file and memory protections are
* compatible. Note that we only worry about
* writability if mapping is shared; in this case,
@@ -265,12 +286,20 @@
maxprot |= VM_PROT_READ;
else if (prot & PROT_READ)
return (EACCES);
- if (flags & MAP_SHARED) {
- if (fp->f_flag & FWRITE)
- maxprot |= VM_PROT_WRITE;
- else if (prot & PROT_WRITE)
- return (EACCES);
- } else
+ /*
+ * If we are sharing potential changes (either via
+ * MAP_SHARED or via the implicit sharing of character
+ * device mappings), and we are trying to get write
+ * permission although we opened it without asking
+ * for it, bail out. Check for superuser, only if
+ * we're at securelevel < 1, to allow the XIG X server
+ * to continue to work.
+ */
+ if (((flags & MAP_SHARED) != 0 ||
+ (vp->v_type == VCHR && disablexworkaround)) &&
+ (fp->f_flag & FWRITE) == 0 && (prot & PROT_WRITE) !=
0)
+ return (EACCES);
+ else
maxprot |= VM_PROT_WRITE;
handle = (void *)vp;
}

Patch for 2.2 systems:

Index: vm_mmap.c
===================================================================
RCS file: /home/cvsup/freebsd/CVS/src/sys/vm/vm_mmap.c,v
retrieving revision 1.53.2.2
diff -u -r1.53.2.2 vm_mmap.c
--- vm_mmap.c 1997/03/25 04:54:29 1.53.2.2
+++ vm_mmap.c 1998/03/10 21:50:46
@@ -157,6 +157,9 @@
vm_prot_t prot, maxprot;
caddr_t handle;
int flags, error;
+ int disablexworkaround;
+
+ addr = (vm_offset_t) uap->addr;

prot = uap->prot & VM_PROT_ALL;
flags = uap->flags;
@@ -230,6 +233,26 @@
flags |= MAP_ANON;
} else {
/*
+ * cdevs does not provide private mappings of any kind.
+ */
+ /*
+ * However, for XIG X server to continue to work,
+ * we should allow the superuser to do it anyway.
+ * We only allow it at securelevel < 1.
+ * (Because the XIG X server writes directly to video
+ * memory via /dev/mem, it should never work at any
+ * other securelevel.
+ * XXX this will have to go
+ */
+ if (securelevel >= 1)
+ disablexworkaround = 1;
+ else
+ disablexworkaround = suser(p->p_ucred,
+ &p->p_acflag);
+ if (vp->v_type == VCHR && disablexworkaround &&
+ (flags & (MAP_PRIVATE|MAP_COPY)))
+ return (EINVAL);
+ /*
* Ensure that file and memory protections are
* compatible. Note that we only worry about
* writability if mapping is shared; in this case,
@@ -243,12 +266,20 @@
maxprot |= VM_PROT_READ;
else if (prot & PROT_READ)
return (EACCES);
- if (flags & MAP_SHARED) {
- if (fp->f_flag & FWRITE)
- maxprot |= VM_PROT_WRITE;
- else if (prot & PROT_WRITE)
- return (EACCES);
- } else
+ /*
+ * If we are sharing potential changes (either via
+ * MAP_SHARED or via the implicit sharing of character
+ * device mappings), and we are trying to get write
+ * permission although we opened it without asking
+ * for it, bail out. Check for superuser, only if
+ * we're at securelevel < 1, to allow the XIG X server
+ * to continue to work.
+ */
+ if (((flags & MAP_SHARED) != 0 ||
+ (vp->v_type == VCHR && disablexworkaround)) &&
+ (fp->f_flag & FWRITE) == 0 && (prot & PROT_WRITE) !=
0)
+ return (EACCES);
+ else
maxprot |= VM_PROT_WRITE;
handle = (caddr_t) vp;
}

VI. Thanks

This advisory is based on the OpenBSD Security Advisory, dated
February 20 2, 1998. Thanks to "Thomas H. Ptacek" <tqbf@enteract.com>
for allowing this.

Thanks to "Cy Schubert" <cschuber@uumail.gov.bc.ca> for porting the
OpenBSD patch to FreeBSD.

=============================================================================
FreeBSD, Inc.

Web Site: http://www.freebsd.org/
Confidential contacts: security-officer@freebsd.org
PGP Key: ftp://ftp.freebsd.org/pub/CERT/public_key.asc
Security notifications: security-notifications@freebsd.org
Security public discussion: security@freebsd.org

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.
=============================================================================

[ End FreeBSD, Inc. Advisory ]

______________________________________________________________________________

CIAC wishes to acknowledge the contributions of FreeBSD, Inc. for the
information contained in this bulletin.
______________________________________________________________________________


CIAC, the Computer Incident Advisory Capability, is the computer
security incident response team for the U.S. Department of Energy
(DOE) and the emergency backup response team for the National
Institutes of Health (NIH). CIAC is located at the Lawrence Livermore
National Laboratory in Livermore, California. CIAC is also a founding
member of FIRST, the Forum of Incident Response and Security Teams, a
global organization established to foster cooperation and coordination
among computer security teams worldwide.

CIAC services are available to DOE, DOE contractors, and the NIH. CIAC
can be contacted at:
Voice: +1 925-422-8193
FAX: +1 925-423-8002
STU-III: +1 925-423-2604
E-mail: ciac@llnl.gov

For emergencies and off-hour assistance, DOE, DOE contractor sites,
and the NIH may contact CIAC 24-hours a day. During off hours (5PM -
8AM PST), call the CIAC voice number 925-422-8193 and leave a message,
or call 800-759-7243 (800-SKY-PAGE) to send a Sky Page. CIAC has two
Sky Page PIN numbers, the primary PIN number, 8550070, is for the CIAC
duty person, and the secondary PIN number, 8550074 is for the CIAC
Project Leader.

Previous CIAC notices, anti-virus software, and other information are
available from the CIAC Computer Security Archive.

World Wide Web: http://www.ciac.org/
(or http://ciac.llnl.gov -- they're the same machine)
Anonymous FTP: ftp.ciac.org
(or ciac.llnl.gov -- they're the same machine)
Modem access: +1 (925) 423-4753 (28.8K baud)
+1 (925) 423-3331 (28.8K baud)

CIAC has several self-subscribing mailing lists for electronic
publications:
1. CIAC-BULLETIN for Advisories, highest priority - time critical
information and Bulletins, important computer security information;
2. SPI-ANNOUNCE for official news about Security Profile Inspector
(SPI) software updates, new features, distribution and
availability;
3. SPI-NOTES, for discussion of problems and solutions regarding the
use of SPI products.

Our mailing lists are managed by a public domain software package
called Majordomo, which ignores E-mail header subject lines. To
subscribe (add yourself) to one of our mailing lists, send the
following request as the E-mail message body, substituting
ciac-bulletin, spi-announce OR spi-notes for list-name:

E-mail to ciac-listproc@llnl.gov or majordomo@tholia.llnl.gov:
subscribe list-name
e.g., subscribe ciac-bulletin

You will receive an acknowledgment email immediately with a confirmation
that you will need to mail back to the addresses above, as per the
instructions in the email. This is a partial protection to make sure
you are really the one who asked to be signed up for the list in question.

If you include the word 'help' in the body of an email to the above address,
it will also send back an information file on how to subscribe/unsubscribe,
get past issues of CIAC bulletins via email, etc.

PLEASE NOTE: Many users outside of the DOE, ESnet, and NIH computing
communities receive CIAC bulletins. If you are not part of these
communities, please contact your agency's response team to report
incidents. Your agency's team will coordinate with CIAC. The Forum of
Incident Response and Security Teams (FIRST) is a world-wide
organization. A list of FIRST member organizations and their
constituencies can be obtained via WWW at http://www.first.org/.

This document was prepared as an account of work sponsored by an
agency of the United States Government. Neither the United States
Government nor the University of California nor any of their
employees, makes any warranty, express or implied, or assumes any
legal liability or responsibility for the accuracy, completeness, or
usefulness of any information, apparatus, product, or process
disclosed, or represents that its use would not infringe privately
owned rights. Reference herein to any specific commercial products,
process, or service by trade name, trademark, manufacturer, or
otherwise, does not necessarily constitute or imply its endorsement,
recommendation or favoring by the United States Government or the
University of California. The views and opinions of authors expressed
herein do not necessarily state or reflect those of the United States
Government or the University of California, and shall not be used for
advertising or product endorsement purposes.

LAST 10 CIAC BULLETINS ISSUED (Previous bulletins available from CIAC)

I-027B: HP-UX Vulnerabilities (CUE, CDE, land)
I-028: Vulnerabilities in CDE
I-029: IBM AIX Telnet Denial-of-Service Vulnerability
I-030: SunOS volrmmount (1) Vulnerability
I-031A: WindowsNT-95 Attacks on DOE Sites
I-032: Sun Solaris Vulnerabilities (vacation, dtaction)
I-033: Sun Solaris Vulnerabilities (ndd, rpc.cmsd)
I-034: Internet Cookies
I-035: SGI Vulnerabilities
I-036: FreeBSD Denial-of Service LAND Attacks



-----BEGIN PGP SIGNATURE-----
Version: 4.0 Business Edition

iQCVAwUBNRAT27nzJzdsy3QZAQFBqAQAxtOvgxwMpvapcKwN9IT6QujKXYQY6N9r
EFHvlXwbHL5iqEG/Ch3NV8NsjJm462uteG+x7ORwuBT3huwYtikk9mGmchbF9Ct7
bV8rS2w/n+DAK3F5u6qtjoA9KBksqUC5NpFcOLR3Ais5t+/VCb/RvT2kvWu/ewKf
+iBnRsY9prY=
=R5Hg
-----END PGP SIGNATURE-----
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close