php5-cgi: IMAP toolkit crash

Bug #485973 reported by Luca Lorenzetto
260
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php-imap (Ubuntu)
Fix Released
High
Unassigned
Dapper
Won't Fix
High
Unassigned
Hardy
Fix Released
High
Devid Antonio Filoni
Intrepid
Fix Released
High
Devid Antonio Filoni
Jaunty
Fix Released
High
Devid Antonio Filoni
Karmic
Fix Released
High
Devid Antonio Filoni
Lucid
Fix Released
High
Unassigned

Bug Description

While using export function in my horde webmail (in order to get a maildir downloaded as mbox file) i get an internal server error and on the php error log i get this:

php5-cgi: IMAP toolkit crash: rfc822.c legacy routine buffer overflow

This bug was released as fixed on USN-628-1 (http://www.ubuntu.com/usn/usn-628-1) as fix for CVE-2008-2829, but as far as i can see, the problem still exists

Here are the os details:

root@posta1:~# lsb_release -rd
Description: Ubuntu 8.04.3 LTS
Release: 8.04
root@posta1:~# dpkg -l php5*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Nome Versione Descrizione
+++-====================================-====================================-========================================================================================
ii php5 5.2.4-2ubuntu5.7 server-side, HTML-embedded scripting language (meta-package)
ii php5-cgi 5.2.4-2ubuntu5.7 server-side, HTML-embedded scripting language (CGI binary)
ii php5-cli 5.2.4-2ubuntu5.7 command-line interpreter for the php5 scripting language
ii php5-common 5.2.4-2ubuntu5.7 Common files for packages built from the php5 source
ii php5-curl 5.2.4-2ubuntu5.7 CURL module for php5
ii php5-gd 5.2.4-2ubuntu5.7 GD module for php5
ii php5-imap 5.2.3-0ubuntu3 IMAP module for php5
un php5-json <non definita> (descrizione non disponibile)
ii php5-ldap 5.2.4-2ubuntu5.7 LDAP module for php5
ii php5-mcrypt 5.2.3-0ubuntu1 MCrypt module for php5
ii php5-mhash 5.2.4-2ubuntu5.7 MHASH module for php5
ii php5-mysql 5.2.4-2ubuntu5.7 MySQL module for php5
un php5-mysqli <non definita> (descrizione non disponibile)
ii php5-suhosin 0.9.22-1 advanced protection module for php5
root@posta1:~# apt-cache policy php5-cgi
php5-cgi:
  Installato: 5.2.4-2ubuntu5.7
  Candidato: 5.2.4-2ubuntu5.7
  Tabella versione:
 *** 5.2.4-2ubuntu5.7 0
        500 http://it.archive.ubuntu.com hardy-updates/main Packages
        500 http://security.ubuntu.com hardy-security/main Packages
        100 /var/lib/dpkg/status
     5.2.4-2ubuntu5 0
        500 http://it.archive.ubuntu.com hardy/main Packages

Revision history for this message
Luca Falavigna (dktrkranz) wrote :

Jamie, mind having a look at this?

affects: ubuntu → php5 (Ubuntu)
Changed in php5 (Ubuntu):
importance: Undecided → High
status: New → Confirmed
security vulnerability: no → yes
Revision history for this message
Luca Lorenzetto (lorenzetto-luca) wrote :

The problem still exists with latest ubuntu php upgrade

root@posta1:~# grep php /var/log/syslog | grep crash
Nov 27 19:42:35 posta1 php5-cgi: IMAP toolkit crash: rfc822.c legacy routine buffer overflow
Nov 27 19:44:11 posta1 php5-cgi: IMAP toolkit crash: rfc822.c legacy routine buffer overflow
root@posta1:~# php-cgi -v
PHP 5.2.4-2ubuntu5.9 with Suhosin-Patch 0.9.6.2 (cgi-fcgi) (built: Nov 26 2009 13:52:47)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with Suhosin v0.9.22, Copyright (c) 2007, by SektionEins GmbH

Revision history for this message
Luca Lorenzetto (lorenzetto-luca) wrote :

no one looking at this bug? :-(

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

In Ubuntu, the php imap plugin is in a separate php-imap source package.

Although USN-628-1 says CVE-2008-2829 was fixed, it was a mistake. The actual binary isn't built from the php5 source package.

CVE-2008-2829 needs to be fixed in the php-imap source package that's in universe.

affects: php5 (Ubuntu) → php-imap (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package php-imap - 5.2.6-0ubuntu7

---------------
php-imap (5.2.6-0ubuntu7) lucid; urgency=low

  * Add quilt support.
  * SECURITY UPDATE: unsafe usage of deprecated imap functions (LP: #485973)
    - add debian/patches/CVE-2008-2829.diff, patch taken from Debian
    - CVE-2008-2829
  * Bump Standards-Version to 3.8.3.
 -- Devid Antonio Filoni <email address hidden> Wed, 06 Jan 2010 17:40:37 +0100

Changed in php-imap (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

Debdiff for karmic-security.

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

debdiff for jaunty-proposed.

Changed in php-imap (Ubuntu Dapper):
status: New → Invalid
status: Invalid → New
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

debdiff for intrepid-security.

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

debdiff for hardy-security.

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

debdiff for dapper-security.

Changed in php-imap (Ubuntu Dapper):
status: New → Confirmed
Changed in php-imap (Ubuntu Hardy):
status: New → Confirmed
Changed in php-imap (Ubuntu Intrepid):
status: New → Confirmed
Changed in php-imap (Ubuntu Jaunty):
status: New → Confirmed
Changed in php-imap (Ubuntu Karmic):
status: New → Confirmed
Changed in php-imap (Ubuntu Dapper):
importance: Undecided → High
Changed in php-imap (Ubuntu Hardy):
importance: Undecided → High
Changed in php-imap (Ubuntu Intrepid):
importance: Undecided → High
Changed in php-imap (Ubuntu Jaunty):
importance: Undecided → High
Changed in php-imap (Ubuntu Karmic):
importance: Undecided → High
Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

Thanks for the debdiffs Devid.

The hardy debdiff is wrong and doesn't compile. Please submit a corrected one. Also, please describe the testing you've performed on these debdiffs.

I have unsubscribed ubuntu-security-sponsors from this bug. Once you've completed the new hardy debdiff and have described the testing, please subscribe ubuntu-security-sponsors again and set the status to "NEW".

Thanks!

Changed in php-imap (Ubuntu Hardy):
status: Confirmed → Incomplete
assignee: nobody → Devid Antonio Filoni (d.filoni)
Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

The dapper debdiff also fails to build. Please re-submit a fixed dapper debdiff also.

Changed in php-imap (Ubuntu Dapper):
status: Confirmed → Incomplete
assignee: nobody → Devid Antonio Filoni (d.filoni)
Revision history for this message
Luca Lorenzetto (lorenzetto-luca) wrote :

I've tested the new package built by d.filoni on karmic on the same environment i used to check the existence of the bug in 9.10. Now, if i try to download the mbox file from horde i get it downloaded without problems and errors on the php error log. So, as far as i can see the bug is fixed.

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

Hardy debdiff

Changed in php-imap (Ubuntu Hardy):
assignee: Devid Antonio Filoni (d.filoni) → nobody
status: Incomplete → Confirmed
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Based on my research the patch is incorrect. Lucid has the incorrect patch in it and needs to be updated. You should be using http://svn.php.net/viewvc?view=revision&revision=267399. If this is in error, please resubmit the patches with the correct references for the origin of the patch. Unsubscribing ubuntu-security-sponsors. Please resubscribe ubuntu-security-sponsors and set the status to 'NEW' when the changes are complete.

Changed in php-imap (Ubuntu Hardy):
status: Confirmed → Incomplete
Changed in php-imap (Ubuntu Intrepid):
status: Confirmed → Incomplete
Changed in php-imap (Ubuntu Jaunty):
status: Confirmed → Incomplete
Changed in php-imap (Ubuntu Karmic):
status: Confirmed → Incomplete
Changed in php-imap (Ubuntu Hardy):
assignee: nobody → Devid Antonio Filoni (d.filoni)
Changed in php-imap (Ubuntu Intrepid):
assignee: nobody → Devid Antonio Filoni (d.filoni)
Changed in php-imap (Ubuntu Jaunty):
assignee: nobody → Devid Antonio Filoni (d.filoni)
Changed in php-imap (Ubuntu Karmic):
assignee: nobody → Devid Antonio Filoni (d.filoni)
Changed in php-imap (Ubuntu Lucid):
status: Fix Released → Incomplete
Revision history for this message
Luca Lorenzetto (lorenzetto-luca) wrote :

Sorry Jamie, but i'm not so expert with packaging and co. but, as far as i can see, a package for Karmic built with the patch created by d.filoni solves my problem and php does crashes no more. The bug IS fixed on php and, as far as i can read on the USN, IS ALSO fixed on ubuntu's php sources...

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Luca, you are correct about the USN. The patch in the USN came from Debian but the code in Ubuntu is not built since php-imap is broken out (and therefore, unfortunately, not tested). Looking at the patch, a lot of the differences can be attributed to changing the memory allocation for 'string' from static to dynamic, but there are other changes that are not as clear.

Marc pointed out to me that the patch is from http://patch-tracker.debian.org/patch/series/view/php5/5.2.6.dfsg.1-1+lenny4/CVE-2008-2829.patch. It looks like all of Devid's patches for hardy and later match this patch. I checked the Debian BTS and couldn't find any regressions from applying this patch.

Sorry for the confusion, though this could have been avoided if the debdiffs followed DEP-3 and gave links to the upstream bug and commits.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

ACK for hardy - karmic

Changed in php-imap (Ubuntu Lucid):
status: Incomplete → Fix Released
Changed in php-imap (Ubuntu Hardy):
status: Incomplete → Fix Committed
Changed in php-imap (Ubuntu Intrepid):
status: Incomplete → Fix Committed
Changed in php-imap (Ubuntu Karmic):
status: Incomplete → Fix Committed
Changed in php-imap (Ubuntu Jaunty):
status: Incomplete → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package php-imap - 5.2.6-0ubuntu6.1

---------------
php-imap (5.2.6-0ubuntu6.1) karmic-security; urgency=low

  * SECURITY UPDATE: unsafe usage of deprecated imap functions (LP: #485973)
    - php_imap.c: apply patch taken from Debian
    - CVE-2008-2829
 -- Devid Antonio Filoni <email address hidden> Wed, 06 Jan 2010 18:58:48 +0100

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package php-imap - 5.2.6-0ubuntu5.1

---------------
php-imap (5.2.6-0ubuntu5.1) jaunty-security; urgency=low

  * SECURITY UPDATE: unsafe usage of deprecated imap functions (LP: #485973)
    - php_imap.c: apply patch taken from Debian
    - CVE-2008-2829
 -- Devid Antonio Filoni <email address hidden> Wed, 06 Jan 2010 18:58:48 +0100

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package php-imap - 5.2.6-0ubuntu3.1

---------------
php-imap (5.2.6-0ubuntu3.1) intrepid-security; urgency=low

  * SECURITY UPDATE: unsafe usage of deprecated imap functions (LP: #485973)
    - php_imap.c: apply patch taken from Debian
    - CVE-2008-2829
 -- Devid Antonio Filoni <email address hidden> Wed, 06 Jan 2010 18:58:48 +0100

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package php-imap - 5.2.3-0ubuntu3.1

---------------
php-imap (5.2.3-0ubuntu3.1) hardy-security; urgency=low

  * SECURITY UPDATE: unsafe usage of deprecated imap functions (LP: #485973)
    - php_imap.c: apply patch taken from Debian
    - CVE-2008-2829
 -- Devid Antonio Filoni <email address hidden> Wed, 06 Jan 2010 18:58:48 +0100

Changed in php-imap (Ubuntu Hardy):
status: Fix Committed → Fix Released
Changed in php-imap (Ubuntu Intrepid):
status: Fix Committed → Fix Released
Changed in php-imap (Ubuntu Jaunty):
status: Fix Committed → Fix Released
Changed in php-imap (Ubuntu Karmic):
status: Fix Committed → Fix Released
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Per Marc's comment on 2010-01-12, the Dapper debdiff needs to be fixed still. Adding 'patch-needswork' tag and leaving Dapper task as Incomplete.

tags: added: patch-needswork
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

I don't have time to work on dapper debdiff...

Changed in php-imap (Ubuntu Dapper):
assignee: Devid Antonio Filoni (d.filoni) → nobody
status: Incomplete → Triaged
Rolf Leggewie (r0lf)
Changed in php-imap (Ubuntu Dapper):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.