Bug 506896 (CVE-2009-2687)

Summary: CVE-2009-2687 php: exif_read_data crash on corrupted JPEG files
Product: [Other] Security Response Reporter: Tomas Hoger <thoger>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: bressers, fedora, jorton, kreilly, maurizio.antillon, rpm, vdanen
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: 2010-01-14 09:24:05 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: 541594, 541595, 541596, 541597, 541598    
Bug Blocks:    
Attachments:
Description Flags
Test case from the upstream bug none

Description Tomas Hoger 2009-06-19 07:31:28 UTC
PHP 5.2.10 fixes one security issue:

  http://www.php.net/releases/5_2_10.php

  Fixed bug #48378 (exif_read_data() segfaults on certain corrupted .jpeg
  files). (Pierre)

Upstream bug report:
  http://bugs.php.net/bug.php?id=48378

Upstream patch:
  http://cvs.php.net/viewvc.cgi/php-src/ext/exif/exif.c#rev1.173.2.5.2.28

The issue is caused by insufficient validation of values read from the input file.  offset_of_ifd is used as index to the array, but its upper bound is not properly checked.  This can result in out-of-bounds read and crash of PHP interpreter, or disclose portions of its memory via EXIF header data used in script's output.

Comment 1 Tomas Hoger 2009-06-19 07:35:16 UTC
Created attachment 348617 [details]
Test case from the upstream bug

Source: http://bugs.php.net/bug.php?id=48378

Comment 2 Tomas Hoger 2009-06-26 16:18:59 UTC
This issue affect PHP versions shipped in Red Hat Enterprise Linux 3, 4 and 5, and Red Hat Application Stack v1 and v2.  Due to the limited impact of the flaw, there's no plan to release updates addressing only this flaw immediately, fix will be included in the next PHP security updates addressing more severe flaws.

Comment 3 Fedora Update System 2009-06-29 15:31:13 UTC
maniadrive-1.2-15.fc11,php-5.2.10-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/maniadrive-1.2-15.fc11,php-5.2.10-1.fc11

Comment 4 Fedora Update System 2009-06-29 15:33:16 UTC
php-5.2.10-1.fc10,maniadrive-1.2-15.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/php-5.2.10-1.fc10,maniadrive-1.2-15.fc10

Comment 5 Vincent Danen 2009-08-27 19:52:44 UTC
Note also that this only seems to affect php on the command-line:

# cat test.php 
<?php
echo "about to read ";
exif_read_data("hello-s148.jpeg","FILE,COMPUTED,ANY_TAG");
echo "read it";
?>
# php test.php 
about to read Segmentation fault
# tail /var/log/httpd/intranet-error_log -f
...
[Thu Aug 27 13:50:13 2009] [error] [client 192.168.250.50] PHP Warning:  exif_read_data() [<a href='function.exif-read-data'>function.exif-read-data</a>]: Unable to open 
/phpsysinfo/test/test.php on line 3

Loading test.php in the web browser shows:

about to read read it

No segmentation fault is recorded in the logs at all, and the web server continues to run so there is no real impact on security from a denial-of-service perspective unless you are using a CLI application.

Comment 6 errata-xmlrpc 2009-09-23 21:38:49 UTC
This issue has been addressed in following products:

  Red Hat Web Application Stack for RHEL 5

Via RHSA-2009:1461 https://rhn.redhat.com/errata/RHSA-2009-1461.html

Comment 8 errata-xmlrpc 2010-01-13 18:10:06 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5
  Red Hat Enterprise Linux 4
  Red Hat Enterprise Linux 3

Via RHSA-2010:0040 https://rhn.redhat.com/errata/RHSA-2010-0040.html