libtiff 4.0.6 segfault / read outside of buffer (CVE-2016-9297)
A segmentation fault and out-of-bounds read occur in libtiff 4.0.6 when processing a crafted TIFF file, due to missing null termination of ASCII tag values. An attacker could cause a denial of service by supplying a malicious TIFF file to applications using the library.
- Fixed in 19 days
- Paid in 19 days
- Disclosed after 2.9 years
segfault and read outside of buffer in libtiff 4.0.6 and possibly earlier. This library is baked into web browsers used by millions and also devices like the PlayStation Portable and the iPhone.
http://bugzilla.maptools.org/show_bug.cgi?id=2590
Reported to the vendor on 7 November 2016:
ASAN:SIGSEGV
=================================================================
==6884==ERROR: AddressSanitizer: SEGV on unknown address 0x7faf9b2d2000 (pc
0x7faf999ecd10 sp 0x7ffe26e325b8 bp 0x7faf9b2d1fff T0)
#0 0x7faf999ecd0f in strlen (/lib/x86_64-linux-gnu/libc.so.6+0x81d0f)
#1 0x7faf999d52ee in _IO_fputs (/lib/x86_64-linux-gnu/libc.so.6+0x6a2ee)
#2 0x490376 in _TIFFPrintField /root/libtiff/libtiff/tif_print.c:127
#3 0x490376 in TIFFPrintDirectory /root/libtiff/libtiff/tif_print.c:647
#4 0x405545 in tiffinfo /root/libtiff/tools/tiffinfo.c:463
#5 0x405545 in main /root/libtiff/tools/tiffinfo.c:152
#6 0x7faf9998cb44 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
#7 0x40648c (/root/libtiff/tools/tiffinfo+0x40648c)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ??:0 strlen
==6884==ABORTING
Fixed by the vendor on 11 November 2016:
2016-11-11 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_dirread.c: in TIFFFetchNormalTag(), make sure that values of tags with
TIFF_SETGET_C16_ASCII / TIFF_SETGET_C32_ASCII access are null terminated, to
avoid potential read outside buffer in _TIFFPrintField().
CVE requested on 12 November 2016: http://www.openwall.com/lists/oss-security/2016/11/12/2
CVE assigned on 14 November 2016: http://www.openwall.com/lists/oss-security/2016/11/14/7
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the library did not ensure that ASCII tag values were null-terminated, leading to an out-of-bounds read when printing the directory.
Impact
An attacker could cause a denial of service (crash) by providing a crafted TIFF file to an application using libtiff.
What the attacker needed
Victim opens a crafted TIFF file
The fix
The vendor fixed the issue by ensuring that ASCII tag values are null-terminated in TIFFFetchNormalTag().
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
libtiff is a library for reading and writing TIFF image files. A bug in how it handles certain text fields in a TIFF file can cause the program to crash or read memory it shouldn't. This means a malicious image file could crash any application that uses libtiff to open it.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.