CVE-2014-8127: Integer Overflow
LibTIFF 4.0.3 allows remote attackers to cause a denial of service (out-of-bounds read and crash) via a crafted TIFF image to the (1) checkInkNamesString function in tifdir.c in the thumbnail tool, (2) compresscontig function in tiff2bw.c in the tiff2bw tool, (3) putcontig8bitCIELab function in tifgetimage.c in the tiff2rgba tool, LZWPreDecode function in tiflzw.c in the (4) tiff2ps or (5) tiffdither tool, (6) NeXTDecode function in tifnext.c in the tiffmedian tool, or (7) TIFFWriteDirectoryTagLongLong8Array function in tifdirwrite.c in the tiffset tool.
Other sources
Multiple out-of-bounds reads were reported in various libtiff tools:
http://bugzilla.maptools.org/showbug.cgi?id=2500 http://bugzilla.maptools.org/showbug.cgi?id=2497 http://bugzilla.maptools.org/showbug.cgi?id=2496 http://bugzilla.maptools.org/showbug.cgi?id=2485 http://bugzilla.maptools.org/showbug.cgi?id=2486 http://bugzilla.maptools.org/showbug.cgi?id=2484
Above upstream bugs were fixed by the below commits:
2014-12-21 Even Rouault <even.rouault> tools/pal2rgb.c, tools/thumbnail.c: fix crash by disabling TIFFTAGINKNAMES copying. The right fix would be to properly copy it, but not worth the burden for those esoteric utilities. http://bugzilla.maptools.org/showbug.cgi?id=2484 (CVE-2014-8127)
2014-12-21 Even Rouault <even.rouault> tools/tiff2bw.c: when Photometric=RGB, the utility only works if SamplesPerPixel = 3. Enforce that http://bugzilla.maptools.org/showbug.cgi?id=2485 (CVE-2014-8127)
2014-12-21 Even Rouault <even.rouault> Fix various crasher bugs on fuzzed images. libtiff/tifdir.c: TIFFSetField(): refuse to set negative values for TIFFTAGXRESOLUTION and TIFFTAGYRESOLUTION that cause asserts when writing the directory libtiff/tifdirread.c: TIFFReadDirectory(): refuse to read ColorMap or TransferFunction if BitsPerSample has not yet been read, otherwise reading it later will cause user code to crash if BitsPerSample > 1 libtiff/tifgetimage.c: TIFFRGBAImageOK(): return FALSE if LOGLUV with SamplesPerPixel != 3, or if CIELAB with SamplesPerPixel != 3 or BitsPerSample != 8 libtiff/tifnext.c: in the "run mode", use tilewidth for tiled images instead of imagewidth to avoid crash tools/bmp2tiff.c: fix crash due to int overflow related to input BMP dimensions tools/tiff2pdf.c: fix crash due to invalid tile count (should likely be checked by libtiff too). Detect invalid settings of BitsPerSample/SamplesPerPixel for CIELAB / ITULAB tools/tiffcrop.c: fix crash due to invalid TileWidth/TileHeight tools/tiffdump.c: fix crash due to overflow of entry count.
— Red Hat
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/tiffto a version that resolves this vulnerability.Fixed in 4.0.6-3 - Upgrade
Upgrade
debian/tiffto a version that resolves this vulnerability.Fixed in 4.0.2-6+deb7u4Fixed in 4.0.6-3 - Compensating control
In libtiff TIFFSetField(), reject negative values for TIFFTAG_XRESOLUTION and TIFFTAG_YRESOLUTION.
- Compensating control
In TIFFReadDirectory(), reject ColorMap or TransferFunction data if BitsPerSample has not yet been read.
- Compensating control
In TIFFRGBAImageOK(), return FALSE for LOGLUV images unless SamplesPerPixel is 3, and for CIELAB images unless SamplesPerPixel is 3 and BitsPerSample is 8.
- Compensating control
In tif_next.c run mode, use tilewidth rather than imagewidth for tiled images.
- Compensating control
In bmp2tiff, prevent integer overflow when processing input BMP dimensions.
- Compensating control
Disable TIFFTAG_INKNAMES copying in pal2rgb and thumbnail.
- Compensating control
In tiff2bw, handle Photometric=RGB only when SamplesPerPixel is 3.
- Compensating control
In tiff2pdf, reject invalid tile counts.
- Compensating control
In tiffcrop, reject invalid TileWidth and TileHeight values.
- Compensating control
In tiffdump, prevent overflow when processing the entry count.
Event History
Frequently Asked Questions
What is the severity of CVE-2014-8127?
CVE-2014-8127 is considered a denial of service vulnerability that can potentially crash the application.
How do I fix CVE-2014-8127?
To fix CVE-2014-8127, you should upgrade to LibTIFF version 4.1.0 or higher as the vulnerability has been addressed in these versions.
What are the affected software versions for CVE-2014-8127?
CVE-2014-8127 affects LibTIFF version 4.0.3 and potentially other versions prior to 4.1.0.
Can CVE-2014-8127 be exploited remotely?
Yes, CVE-2014-8127 can be exploited remotely through crafted TIFF images.
What types of attacks are associated with CVE-2014-8127?
CVE-2014-8127 is associated with denial of service attacks that result from out-of-bounds read vulnerabilities.