Bug 451025 - crash in mailimf_group_parse due to a colon in To: address
crash in mailimf_group_parse due to a colon in To: address
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: libetpan (Show other bugs)
8
All Linux
low Severity urgent
: ---
: ---
Assigned To: Andreas Bierfert
Fedora Extras Quality Assurance
: Security
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-12 10:03 EDT by Vinay Y S
Modified: 2008-07-26 02:07 EDT (History)
1 user (show)

See Also:
Fixed In Version: 0.54-1.fc9
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-06-26 04:31:52 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
The test message that causes the crash in mime parser. (363 bytes, text/plain)
2008-06-14 18:45 EDT, Vinay Y S
no flags Details
A simple test code that reproduces the crash. (1.42 KB, text/plain)
2008-06-14 18:46 EDT, Vinay Y S
no flags Details
A patch that fixes the crash (511 bytes, patch)
2008-06-14 18:59 EDT, Vinay Y S
no flags Details | Diff

  None (edit)
Description Vinay Y S 2008-06-12 10:03:52 EDT
Description of problem:
If the email's To: header has a colon after display name, etpan crashes in
library's src/low-level/imf/mailimf.c line 3049 

 free_mailbox_list:
  mailimf_mailbox_list_free(mailbox_list);

For example:
A mail having
To: Michael:
will cause the mailbox_list to be null and upon reaching this list free
function, it will segfault and crash.

Version-Release number of selected component (if applicable):
libetpan-0.52-1

How reproducible:
Steps to Reproduce:
1. Please take a standard e-mail and insert a : in front of the displayname in
the To e-mail address. (This happens due to bad e-mail server sending such e-mails).
2. Parse that e-mail with etpan. 
3. Notice the segfault.
  
Actual results:
etpan crashes.

Expected results:
etpan should return error.

Additional info:
A fix is to check for null of mailbox_list before calling
mailimf_mailbox_list_free on it.

Please provide this fix ASAP.
Comment 1 Tomas Hoger 2008-06-12 16:07:47 EDT
Vinay, how did you come across this problem?  Only application in Fedora using
libetpan seems to be the claws-mail, but I fail to reproduce the problem with
it. Why did you flagged this as security issue?
Comment 2 Andreas Bierfert 2008-06-13 10:15:25 EDT
Seems like he is using the etpan mail client provided from the etpan folks.
Could you provide some more info regarding this?
Comment 3 Vinay Y S 2008-06-14 09:02:51 EDT
Yes, I've written an application that receives e-mail from a mail gateway and
parses it using etpan library. When a mail with a colon in the To address comes
in, the parser crashes.

Let me know if you need a standalone code to repro this issue.
Comment 4 Vinay Y S 2008-06-14 18:45:20 EDT
Created attachment 309375 [details]
The test message that causes the crash in mime parser.

This mime message has an extra colon in the To header after the display name.
The parser doesn't handle this case. It goes into a bad state and tries to free
up a unallocated structure, causing it to seg-fault.
Comment 5 Vinay Y S 2008-06-14 18:46:43 EDT
Created attachment 309376 [details]
A simple test code that reproduces the crash.

This is a very simple test code that calls mailmime_parse on the test message
to reproduce the crash.
Comment 6 Vinay Y S 2008-06-14 18:59:14 EDT
Created attachment 309377 [details]
A patch that fixes the crash

This patch changes libetpan-0.52/src/low-level/imf/mailimf.c
mailimf_group_parse function to checks the mailbox_list pointer before calling
mailimf_mailbox_list_free on it.
Comment 7 Vinay Y S 2008-06-14 19:01:46 EDT
Please accept the above patch and release a fixed rpm for Fedora.

Although the above patch fixes this crash, ideally the parser should be able to
ignore the extra : after displayname and continue parsing. This maybe a more
complex fix.
Comment 8 Vinay Y S 2008-06-15 14:09:28 EDT
This issue has been fixed with the same null check in the upstream cvs repository.

http://libetpan.cvs.sourceforge.net/libetpan/libetpan/src/low-level/imf/mailimf.c?view=diff&r1=1.46&r2=1.47

Comment 9 Tomas Hoger 2008-06-16 10:16:14 EDT
Un-restricting bug, as the patch is public in upstream CVS.
Comment 10 Fedora Update System 2008-06-17 11:18:23 EDT
libetpan-0.54-1.fc8 has been submitted as an update for Fedora 8
Comment 11 Fedora Update System 2008-06-17 11:20:22 EDT
libetpan-0.54-1.fc9 has been submitted as an update for Fedora 9
Comment 12 Fedora Update System 2008-06-20 15:06:28 EDT
libetpan-0.54-1.fc9 has been pushed to the Fedora 9 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update libetpan'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F9/FEDORA-2008-5469
Comment 13 Fedora Update System 2008-06-26 04:31:50 EDT
libetpan-0.54-1.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 14 Fedora Update System 2008-06-26 04:34:45 EDT
libetpan-0.54-1.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 15 Fedora Update System 2008-07-26 02:07:13 EDT
libetpan-0.54-1.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.