[VulnWatch] Rapid7 Advisory R7-0025: Buffer Overflow in NVIDIA Binary Graphics Driver For Linux

From: advisory@private
Date: Mon Oct 16 2006 - 11:54:16 PDT


_______________________________________________________________________
                     Rapid7, LLC Security Advisory
            Visit http://www.rapid7.com/ to download NeXpose,
        SC Magazine Winner of Best Vulnerability Management product.
_______________________________________________________________________


Rapid7 Advisory R7-0025
Buffer Overflow in NVIDIA Binary Graphics Driver For Linux

   Published:  Oct 16, 2006
   Revision:   1.0
   http://www.rapid7.com/advisories/R7-0025.jsp

1. Affected system(s):

   KNOWN VULNERABLE:
    o NVIDIA Driver For Linux v8774
    o NVIDIA Driver For Linux v8762

   PROBABLY VULNERABLE:
    o NVIDIA Driver for FreeBSD
    o NVIDIA Driver for Solaris
    o Earlier versions

   KNOWN FIXED:
    o None

2. Summary

   The NVIDIA Binary Graphics Driver for Linux is vulnerable to a
   buffer overflow that allows an attacker to run arbitrary code as
   root. This bug can be exploited both locally or remotely (via
   a remote X client or an X client which visits a malicious web page).
   A working proof-of-concept root exploit is included with this
   advisory.

   The NVIDIA drivers for Solaris and FreeBSD are also likely to be
   vulnerable.

3. Vendor status and information

   NVIDIA Corporation
   http://www.nvidia.com

   There have been multiple public reports of this NVIDIA bug on the
   NVNews forum [1,2] and elsewhere, dating back to 2004 [3]. NVIDIA's
   first public acknowledgement of this bug was on July 7th, 2006. In a
   public posting [1] on the NVNews forum, an NVIDIA employee reported
   having reproduced the problem, assigned it bug ID 239065, and promised
   a fix would be forthcoming.

   As of the publication date, the latest NVIDIA binary driver is still
   vulnerable. Furthermore, it is our opinion that NVIDIA's binary driver
   remains an unacceptable security risk based on the large numbers of
   reproducible, unfixed crashes that have been reported in public forums
   and bug databases. This number does not include bugs reported directly
   to NVIDIA.

   1. http://www.nvnews.net/vbulletin/showthread.php?p=931048   (Jul 2006)
   2. http://www.nvnews.net/vbulletin/showthread.php?t=76493    (Sep 2006)
   3. https://bugs.freedesktop.org/show_bug.cgi?id=2129         (Dec 2004)
   4. http://lists.freedesktop.org/archives/xorg/2005-January/005642.html
   5. http://forums.gentoo.org/viewtopic.php?t=282107           (Jan 2005)
   6. https://bugs.eclipse.org/bugs/show_bug.cgi?id=87299       (Mar 2005)
   7. http://www.nvnews.net/vbulletin/showthread.php?t=76206    (Sep 2006)

4. Solution

   Disable the binary blob driver and use the open-source "nv" driver
   that is included by default with X.

5. Detailed analysis

   There are two NVIDIA graphics drivers for Linux: a closed-source
   binary blob driver provided by NVIDIA (which provides acceleration)
   and an open-source driver (which lacks acceleration). NVIDIA's
   binary blob driver contains an error in its accelerated rendering
   of glyphs (text character data) that can be exploited to write
   arbitrary data to anywhere in memory. The open-source driver is
   not vulnerable.

   The XRender extension provides a client function named
   XRenderCompositeString8 which tells the X server to render glyphs
   onto the screen. This request is processed by the server's
   ProcRenderCompositeGlpyhs function. This function pulls the glyphs
   out of the render request, constructs a glyph list, and then calls
   into the graphics driver via a registered callback function.

   The NVIDIA binary blob driver registers a function named _nv000373X.
   This function calculates a bounding BoxRec of the total area occupied
   by the glyph data. It then uses Xalloc to allocate a buffer large
   enough to hold the data by multiplying width * height. This buffer
   is then passed to another internal function called _nv000053X.

   The _nv000053X function iterates over the glyph list and copies
   glyph data into the buffer using each glyph's accumulated width,
   xOff, height, and yOff values to calculate the destination position
   in the buffer. The NVIDIA binary blob driver does not check this
   calculation against the size of the allocated buffer. As a result,
   a short sequence of user-supplied glyphs can be used to trick the
   function into writing to an arbitrary location in memory.

   It is important to note that glyph data is supplied to the X server
   by the X client. Any remote X client can gain root privileges on
   the X server using the proof of concept program attached.

   It is also trivial to exploit this vulnerability as a DoS by causing
   an existing X client program (such as Firefox) to render a long text
   string. It may be possible to use Flash movies, Java applets, or
   embedded web fonts to supply the custom glyph data necessary for
   reliable remote code execution.

   A simple HTML page containing an INPUT field with a long value is
   sufficient to demonstrate the DoS.

5. Credit

   This vulnerability was discovered by Derek Abdine of Rapid7. Special
   thanks to Marc Bevand for his assistance.

6. Contact Information

   Rapid7, LLC
   Email: advisory@private
   Web: http://www.rapid7.com
   Phone: +1 (310) 316-1235

7. Disclaimer and Copyright

   Rapid7, LLC is not responsible for the misuse of the information
   provided in our security advisories. These advisories are a service
   to the professional security community. There are NO WARRANTIES with
   regard to this information. Any application or distribution of this
   information constitutes acceptance AS IS, at the user's own risk.
   This information is subject to change without notice.

   This advisory Copyright (C) 2006 Rapid7, LLC. Permission is hereby
   granted to redistribute this advisory, providing that no changes are
   made and that the copyright notices and disclaimers remain intact.





This archive was generated by hypermail 2.1.3 : Mon Oct 16 2006 - 18:34:41 PDT