what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

iDEFENSE Security Advisory 2004-12-21.4

iDEFENSE Security Advisory 2004-12-21.4
Posted Dec 31, 2004
Authored by iDefense Labs, infamous41md | Site idefense.com

iDEFENSE Security Advisory 12.21.2004-4 - Remote exploitation of a heap-based buffer overflow vulnerability within the LibTIFF package could allow attackers to execute arbitrary code.

tags | advisory, remote, overflow, arbitrary
SHA-256 | 29d38151960c7c164835aed41fe8fc1b9de34bb6dce44ac108c2d43e583658a1

iDEFENSE Security Advisory 2004-12-21.4

Change Mirror Download
libtiff Directory Entry Count Integer Overflow Vulnerability 

iDEFENSE Security Advisory 12.21.04
www.idefense.com/application/poi/display?id=174&type=vulnerabilities
December 21, 2004

I. BACKGROUND

This software provides support for the Tag Image File Format (TIFF), a
widely used format for storing image data. Included in this software
distribution is a library, libtiff, for reading and writing TIFF, a
small collection of tools for doing simple manipulations of TIFF images
on UNIX systems, and documentation on the library and tools. A small
assortment of TIFF-related software for UNIX that has been contributed
by others is also included.

More information is available at the following site:
http://www.remotesensing.org/libtiff/

II. DESCRIPTION

Remote exploitation of a heap-based buffer overflow vulnerability
within the LibTIFF package could allow attackers to execute arbitrary
code.

The vulnerability specifically exists due to insufficient validation of
user-supplied data when calculating the size of a directory entry. A
TIFF file includes a number of directory entry header fields that
describe the data in the file. Included in these entries is an entry
count and offset value that are calculated to determine the size and
location of the data for that entry. If the directory entry type is
TIFF_ASCII or TIFF_UNDEFINED, the a call to CheckMalloc is made in
order to allocate space for the entry contents as shown below from
tif_dirread.c:

cp = CheckMalloc(tif, dp->tdir_count+1, 1, mesg);
if( (ok = (cp && TIFFFetchString(tif, dp, cp))) != 0 )
cp[dp->tdir_count] = '\0'; /* XXX */

If the tdir_count is set to 0xffffffff, the increment will cause the
function call to allocate 0 bytes of memory and later memcpy calls will
cause the buffer to overflow. An attacker may generate a malicious TIFF
file which takes advantage of this unchecked calculation to execute
arbitrary code with permissions of the user opening the TIFF file.

III. ANALYSIS

Remote attackers may be able to execute arbitrary code with permissions
of the user opening the malformed TIFF file. The exposure to this
vulnerability is mitigated by the fact that user interaction is
required and that the user must view the malicious TIFF file in an
application that is linked to a vulnerable version of libtiff.

IV. DETECTION

iDEFENSE has confirmed the existence of this vulnerability in LibTIFF
3.5.7 and 3.7.0.

The following vendors distribute susceptible TIFF packages within their
respective operating system distributions:

- Debian Linux
- Gentoo Linux
- RedHat Linux
- SuSE Linux

V. WORKAROUND

Only open TIFF files from trusted users or in an application not linked
against vulnerable versions of libtiff.

VI. VENDOR RESPONSE

The following patch will address this vulnerability:

--- tif_dirread.c.bak 2004-12-19 21:04:00.000000000 +0300
+++ tif_dirread.c 2004-12-19 21:04:03.000000000 +0300
@@ -71,7 +71,7 @@
/*
* XXX: Check for integer overflow.
*/
- if (elem_size && bytes / elem_size == nmemb)
+ if (nmemb && elem_size && bytes / elem_size == nmemb)
cp = (char*)_TIFFmalloc(bytes);

if (cp == NULL)

(the same applies for tif_fax3.c)

This patch has been incorporated into libtiff 3.7.1.

VII. CVE INFORMATION

A Mitre Corp. Common Vulnerabilities and Exposures (CVE) number has not
been assigned yet.

VIII. DISCLOSURE TIMELINE

12/17/2004 Initial vendor notification
12/17/2004 iDEFENSE clients notified
12/21/2004 Coordinated public disclosure

IX. CREDIT

infamous41md[at]hotpop.com is credited with this discovery.

Get paid for vulnerability research
http://www.idefense.com/poi/teams/vcp.jsp

X. LEGAL NOTICES

Copyright (c) 2004 iDEFENSE, Inc.

Permission is granted for the redistribution of this alert
electronically. It may not be edited in any way without the express
written consent of iDEFENSE. If you wish to reprint the whole or any
part of this alert in any other medium other than electronically, please
email customerservice@idefense.com for permission.

Disclaimer: The information in the advisory is believed to be accurate
at the time of publishing based on currently available information. Use
of the information constitutes acceptance for use in an AS IS condition.
There are no warranties with regard to this information. Neither the
author nor the publisher accepts any liability for any direct, indirect,
or consequential loss or damage arising from use of, or reliance on,
this information.
Login or Register to add favorites

File Archive:

September 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close