|
--=-1rIS48eoy7iDmqyvYLuH
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
------------------------------------------------------------------------
yTNEF/Evolution TNEF Attachment decoder plugin directory traversal &
buffer overflow vulnerabilities
------------------------------------------------------------------------
Yorick Koster, June 2009
------------------------------------------------------------------------
Abstract
------------------------------------------------------------------------
yTNEF & the Evolution TNEF Attachment decoder plugin are affected by
several directory traversal and buffer overflow vulnerabilities. The
directory traversal vulnerabilities allow attackers to overwrite or
create local files with the privileges of the target user. Exploiting
the buffer overflow vulnerabilities allows for arbitrary code execution
with the privileges of the target user.
------------------------------------------------------------------------
See also
------------------------------------------------------------------------
- #2009-013 yTNEF/Evolution TNEF attachment decoder input sanitization
errors [2]
------------------------------------------------------------------------
Tested version
------------------------------------------------------------------------
These vulnerabilities were discovered using the latest (stable) versions
of Evolution (currently 2.62.2) and yTNEF (currently 2.6). The
vulnerabilities were verified on the following Linux distributions:
- GNOME version of Mandriva Linux 2009 Spring running Evolution
2.26.1.1 (Evolution plugin installed by default)
- Ubuntu 9.04 running Evolution 2.26.1 (with
evolution-plugins-experimental package installed)
------------------------------------------------------------------------
Affected functions
------------------------------------------------------------------------
The following functions are affected by these issues:
Evolution plugin:
* processTnef()
* saveVCard()
* saveVCalendar()
* saveVTask()
yTNEF:
* ProcessTNEF()
* SaveVCard()
* SaveVCalendar()
* SaveVTask()
------------------------------------------------------------------------
Fix
------------------------------------------------------------------------
There is currently no fix available.
------------------------------------------------------------------------
Introduction
------------------------------------------------------------------------
Transport Neutral Encapsulation Format (TNEF) is a proprietary e-mail
attachment format used by Microsoft Outlook and Microsoft Exchange
Server. A plugin [3] for Evolution exists that provides basic support
for TNEF encoded e-mails. This plugin uses the ytnef library [4]
(libytnef) for processing TNEF messages. It borrows code from the ytnef
program, which is a program to work with procmail to decode TNEF streams
(winmail.dat attachments). Both applications share (almost) code and
are, because of this, both affected by the issues described in this
document.
------------------------------------------------------------------------
Evolution TNEF Attachment decoder plugin
------------------------------------------------------------------------
The plugin is started on e-mail attachments that have a MIME type of
either application/vnd.ms-tnef or application/ms-tnef. It creates a
temporary directory under ~/.evolution/cache/tmp using the format
tnef-attachment-XXXXXX. The TNEF attachment is saved as
.evo-attachment.tnef.
void
org_gnome_format_tnef(void *ep, EMFormatHookTarget *t)
{
[...]
=09
tmpdir = e_mkdtemp("tnef-attachment-XXXXXX");
if (tmpdir == NULL)
return;
=09
filepath = tmpdir;
=09
name = g_build_filename(tmpdir, ".evo-attachment.tnef",
NULL);
=09
out = camel_stream_fs_new_with_name(name, O_RDWR|O_CREAT, 0666);
The saved file is parsed by TNEFParseFile(), the result is stored in a
struct of the type TNEFStruct. This struct is passed to the function
processTnef(), which tries to extract all relevant data and attachments
from the TNEF stream. Each relevant part of the TNEF stream is stored
within the previously created temporary directory that are made
available to the end user as separate e-mail attachments.
/* Extracting the winmail.dat */
TNEFInitialize(tnef);
tnef->Debug = verbose;
if (TNEFParseFile(name, tnef) == -1) {
printf("ERROR processing file\n");
}
processTnef(tnef);
=09
TNEFFree(tnef);
/* Extraction done */
------------------------------------------------------------------------
yTNEF
------------------------------------------------------------------------
yTNEF processes TNEF files in a similar manner. It receives a file name
from the command line, calls TNEFParseFile() that creates a struct
TNEFStruct after which ProcessTNEF() is called. If ProcessTNEF() finds
attachments it can process, these attachments will be saved locally. The
ProcessTNEF() function is almost the same as the processTnef() function
of the Evolution plugin.
int main(int argc, char ** argv) {
[...]
=09
for(i=1; i