Portcullis Security Advisory - 09-004 Vulnerable System: KDE Vulnerability Title: KMail Attachment Mime Type Spoofing Enables Javascript Injection. Vulnerability Discovery And Development: Portcullis Security Testing Services. Credit For Discovery: Tim Brown - Portcullis Computer Security Ltd. Affected systems: All known versions of KDE; the vulnerability discovered was for version 3.5.7. Details: It is possible for an attacker to send an attachment with a spoofed MIME type such that whilst it may have a harmless looking extension such as ".txt", attempting to open the attachment in KMail will lead to it being rendered by the user configured HTML browser. When the reciever tries to open the attachment they will be asked whether they wish to load it into Konqueror. Given the benign extension, they may well click yes, in which case it will be opened and any included JavaScript will be executed. KMail will indicate via the attachments icon that it considers the file to be suitable for rendering in Konqueror. Note: KMail does not apply any further validation or sanitisation and since attachments are not opened within a sandbox but rather as temporary files from the "file://" IO slave, it is possible to craft an attachment which when opened will lead to arbitrary JavaScript being executed in a trusted context. The "file://" IO slave is trusted to execute across domains. Impact: In the worst case an attacker may be able to use this to execute malicious code on a visitors computers. A proof of concept has been created which retrieves the users "/etc/passwd" and sends to a remote web server. Portcullis agree with KDE's assessment that exploitation of these vulnerabilities is unlikely, however we are concerned about the fact that active content may be executed in cases where the user does not expect it. Exploit: The proof of concept exploit code is available. Vendor Status: 10/07/2007 - Vendors sent copy of an initial paper "Kreating HavoK" 12/07/2007 - Trolltech & KDE respond 16/07/2007 - Trolltech issue patch for format string vulnerability (CVE-2007-3388) identified in paper 19/07/2007 - Trolltech provide update on their response 27/07/2007 - Trolltech publish their advisory Throughout 2007, further discussions are held between Portullis and KDE via IRC but due to work on KDE 4.x no resolutions are forthcoming. Portcullis agree to hold back until such time as KDE can reasonably respond. 20/12/2008 - Due to the extended period of non-disclosure, in late 2008 Portcullis decide to resubmit the problems as a series of advisories 18/02/2009 - Portcullis contact oCERT and KDE asking for help from oCERT to coordinate disclosure 05/03/2009 - oCERT & KDE respond asking for proof of concepts Portcullis provide proof of concept exploits and discuss the issue in depth with representatives of KDE and oCERT via IRC and email. KDE confirm that have improved the sandbox that is applied to JavaScript to prevent the XMLHttpRequest object being called by resources not exposed over HTTP or WebDAV to prevent the same origin policy violation. 04/11/2009 - Advisory published. Portcullis would like to thank Richard Moore and David Faure from KDE and Andrea Barisani from oCERT Copyright: Copyright � Portcullis Computer Security Limited 2009, All rights reserved worldwide. Permission is hereby granted for the electronic redistribution of this information. It is not to be edited or altered in any way without the express written consent of Portcullis Computer Security Limited. Disclaimer: The information herein contained may change without notice. Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. In no event shall the author/distributor (Portcullis Computer Security Limited) be held liable for any damages whatsoever arising out of or in connection with the use or spread of this information.