Tried, Tested and Proven

Security Advisory 09-008 – Insufficient Input Validation By IO Slaves

Vulnerability Title:

Insufficient Input Validation By IO Slaves.

Vulnerable System:

KDE

Vulnerability discovery and development:

Portcullis Security Testing Services

Credit for Discovery:

Tim Brown – Portcullis Computer Security Ltd.

Affected Systems:

All known versions of KDE; unless otherwise stated, the vulnerabilities concerned were identified in version 3.5.7 and have been confirmed on 4.1.80.

Details:

Whilst investigating how KDE handles custom protocols, it was discovered that a number of the protocol handlers (referred to as IO slaves) did not satisfactorily handle malicious input. It is possible for an attacker to inject JavaScript by manipulating IO slave URI such that the JavaScript from the manipulated request is returned in the response. Example URLs that trigger this behaviour include:

  • pydoc:
    [body][script]alert('xss')[/script][/body]

    – fixed in 3.5.10

  • man:[script src="http://server/test.js"] – fixed in 3.5.10
  • help:[script]alert(‘xss’)[/script]
  • info:/dir/[script]alert(‘xss’)[/script]
  • perldoc:[body onLoad="javascript:alert(1)"]

An attacker may also be able to inject JavaScript by manipulating the response to requests made by the “finger://” IO slave such that the JavaScript from the manipulated response is rendered in Konqueror.

Additionally, by manipulating requests to the “help://” IO slave, arbitrary files can be returned from outside of the intended document root. For example:

  • help:/../../../../../../../../../../../etc/passwd

In the worst case an attacker may be able to use this to execute malicious code on a visitors computer. However, KDE mitigates this risk by attempting to ensure that such URLs cannot be embedded directly into Internet hosted content and a warning will be displayed when the links themselves are accessed. Portcullis agree with KDE’s assessment that exploitation of these vulnerabilities is unlikely, however we are concerned about the lack of adequate input validation considering similar issues have resulted in remote code execution on other platforms.

Impact:

In the worst case an attacker may be able to use this to execute malicious code on a visitors computer. However, KDE mitigates this risk by attempting to ensure that such URLs cannot be embedded directly into Internet hosted content and a warning will be displayed when the links themselves are accessed. Portcullis agree with KDE’s assessment that exploitation of these vulnerabilities is unlikely, however we are concerned about the lack of adequate input validation considering similar issues have resulted in remote code execution on other platforms.

Exploit:

Exploit code is not required.

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 they have fixed the input sanitisation problems and 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.