[PEAR-BUG] Bug #20555 [Com]: Mail_mimeDecode improperly handles S/MIME Encrypted messages

[email protected] ("marcello") Fri, 29 Jul 2016 07:15:19 -0400 (EDT)
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at http://pear.php.net/bugs/bug.php?id=20555&edit=1

 ID:               20555
 Comment by:       marcello
 Reported By:      marcello dot ceschia at gmail dot com
 Summary:          Mail_mimeDecode improperly handles S/MIME Encrypted
                   messages
 Status:           Feedback
 Type:             Bug
 Package:          Mail_mimeDecode
 Operating System: FreeBSD 10.1-STABLE
 Package Version:  1.5.5
 PHP Version:      5.5.25
 New Comment:

I did some debug to get z-push working with S/MIME messages and provided
a solution for that, see https://jira.z-hub.io/browse/ZP-1006
I'm not totaly sure if this complies to RFC1341 but it is working with
BlackBerry HUB and android nine client


Previous Comments:
------------------------------------------------------------------------

[2015-06-03 06:33:55] alan_k

<div id="changeset">
<span class="removed">-Status: Open</span>
<span class="added">+Status: Feedback</span>
</div>Can you work out a patch for this?

------------------------------------------------------------------------

[2015-06-02 16:16:51] tickerguy

Description:
------------
When passed an S/MIME encrypted message, which specifies the MIME 
component as an attachment, the package fails to return the base64 
component (which is found in the message body without a delimiter, as 
there is no other component) as an attachment.  It instead returns it in

the message body component despite the fact that the disposition is 
declared as an attachment.

This causes synchronization software that relies on the proper behavior

(e.g. Z-push) to push an incorrect email package to the mobile device, 
which is unable to decode it as the expected attachment is missing.

Note that PGP-encrypted messages fail in the same fashion for the same 
reason.

Test script:
---------------
Send a S/MIME encrypted email to yourself.  Note (by inspection of the
mail spool) that the following is in the Content headers:

Content-Type: application/pkcs7-mime; name="smime.p7m";
smime-type=enveloped-data
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7m"
Content-Description: S/MIME Encrypted Message

Note that when mimeDecode processes the mail there are no attachments
returned and the base64 component, which (if you specified) is decoded
to binary, is returned in the body structure instead.

Attached file is a test message that can be passed through this routine
to reproduce the bug.

Expected result:
----------------
The body should be an empty string and there should be one attachment 
returned containing the encrypted data.


Actual result:
--------------
The message body contains the base64 data and the attachment list/array

has no elements.

------------------------------------------------------------------------


-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=20555&edit=1