Bug 1319666 (CVE-2016-3186)

Summary: CVE-2016-3186 libtiff: buffer overflow in gif2tiff
Product: [Other] Security Response Reporter: Andrej Nemec <anemec>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: fridrich.strba, henri, phracek, sardella, security-response-team, slawomir
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-08 02:49:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1319503, 1322307, 1322309, 1322310    
Bug Blocks: 1319667    
Description Flags
Patch solving this buffer overflow fridrich.strba: review?

Description Andrej Nemec 2016-03-21 10:01:30 UTC
A buffer overflow vulnerability was reported in libtiff library, in gif2tiff component. A maliciously crafted file could cause the application to crash.

Original bug report with reproducer:


Comment 1 Andrej Nemec 2016-03-21 10:01:34 UTC

Name: Aladdin Mubaied

Comment 2 Huzaifa S. Sidhpurwala 2016-03-30 09:26:38 UTC
Created libtiff tracking bugs for this issue:

Affects: fedora-all [bug 1322307]

Comment 3 Huzaifa S. Sidhpurwala 2016-03-30 09:26:44 UTC
Created mingw-libtiff tracking bugs for this issue:

Affects: fedora-all [bug 1322309]

Comment 4 Huzaifa S. Sidhpurwala 2016-03-30 09:30:18 UTC
Created mingw-libtiff tracking bugs for this issue:

Affects: epel-7 [bug 1322310]

Comment 5 Huzaifa S. Sidhpurwala 2016-03-30 09:40:13 UTC
Also disclosed on oss-security mailing list via:

Comment 6 Fridrich Strba 2016-04-06 14:05:21 UTC
Created attachment 1144235 [details]
Patch solving this buffer overflow

When getc detects that that it is at the end of file, it returns EOF which is a negative number. The exact value depends on implementation, but it is always a negative number. On Linux it is normally -1. That while loop check only if the count is <= 255. If the number count is negative, that condition is satisfied. Nonetheless, in the subsequent fread, the count is casted to size_t where it becomes a huge number, hence the buffer overflow. This patch is adding a check for the return of getc being positive, which solves the buffer overflow.

Comment 7 Henri Salo 2016-05-31 07:39:37 UTC
For your information I noticed additional buffer overflow issue in readgifimage(), which have been reported to upstream in http://bugzilla.maptools.org/show_bug.cgi?id=2552

Comment 8 Henri Salo 2016-06-02 06:17:11 UTC
CVE-2016-5102 has been assigned to buffer overflow issue in readgifimage(), which was reported in http://bugzilla.maptools.org/show_bug.cgi?id=2552

I am not sure how this should be reported to bugzilla.redhat.com as a separate issue.

Comment 9 errata-xmlrpc 2019-08-06 12:08:46 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2019:2053 https://access.redhat.com/errata/RHSA-2019:2053