Bug 1177327 (CVE-2015-0973)

Summary: CVE-2015-0973 libpng: Heap-buffer overflow png_combine_row() with very wide interlaced images
Product: [Other] Security Response Reporter: Huzaifa S. Sidhpurwala <huzaifas>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED NOTABUG QA Contact:
Severity: urgent Docs Contact:
Priority: urgent    
Version: unspecifiedCC: phracek, vkaigoro
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-12-26 07:05:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1176755, 1179187    

Description Huzaifa S. Sidhpurwala 2014-12-26 06:53:47 UTC
A heap-based overflow was found in the png_combine_row() function of the libpng library, when very large interlaced images were used. This flaw was fixed in libpng-1.5.21 and 1.6.16.

Upstream patch:

http://sourceforge.net/p/libpng/code/ci/dc294204b641373bc6eb603075a8b98f51a75dd8/

External Reference:

http://seclists.org/oss-sec/2014/q4/1133

Comment 1 Huzaifa S. Sidhpurwala 2014-12-26 07:04:24 UTC
When a very large interlaced PNG image in created, such that its width or height exceeds the maximum value allowed for png_uint_32 data type (which is same as uint_32), it results in an integer overflow followed by a heap-based buffer overflow in the png_combine_row() function.

The version of libpng as shipped with Red Hat Enterprise Linux, however imposes a limit on the maximum width and height of PNG image, which can be processed by the library.

In Red Hat Enterprise Linux 5 and 6 via pngconf.h:

#  define PNG_USER_WIDTH_MAX 1000000L
#  define PNG_USER_HEIGHT_MAX 1000000L

In Red Hat Enterprise Linux 7 via pngusr.dfa as:

"option SAFE_LIMITS on" 

which in turn leads to:

#ifdef PNG_SAFE_LIMITS_SUPPORTED
   /* 'safe' limits */
#  ifndef PNG_USER_WIDTH_MAX
#     define PNG_USER_WIDTH_MAX 1000000
#  endif
#  ifndef PNG_USER_HEIGHT_MAX
#     define PNG_USER_HEIGHT_MAX 1000000
#  endif
#  ifndef PNG_USER_CHUNK_CACHE_MAX
#     define PNG_USER_CHUNK_CACHE_MAX 128
#  endif
#  ifndef PNG_USER_CHUNK_MALLOC_MAX
#     define PNG_USER_CHUNK_MALLOC_MAX 8000000
#  endif

in pngpriv.h

Comment 2 Huzaifa S. Sidhpurwala 2014-12-26 07:05:10 UTC
Statement:

Not vulnerable. This issue does not affect the version of libpng as shipped with Red Hat Enterprise Linux 5, 6 and 7. For a more detailed explanation please refer to: https://bugzilla.redhat.com/show_bug.cgi?id=1177327#c1

Comment 3 Huzaifa S. Sidhpurwala 2014-12-26 07:05:56 UTC
This issue does not affect the version of libpng as shipped with Fedora 20 and 21.

Comment 4 Huzaifa S. Sidhpurwala 2015-01-07 04:40:27 UTC
*** Bug 1179186 has been marked as a duplicate of this bug. ***

Comment 5 Fedora Update System 2015-03-09 08:19:21 UTC
libpng10-1.0.63-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 6 Fedora Update System 2015-03-09 08:28:27 UTC
libpng10-1.0.63-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2015-03-09 08:37:23 UTC
libpng10-1.0.63-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2015-03-15 00:59:37 UTC
libpng10-1.0.63-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.