The_Arhitect Posted January 19, 2012 Report Posted January 19, 2012 Drupal CKEditor 3.0 - 3.6.2 - Persistent EventHandler XSS# Exploit Title: Drupal CKEditor 3.0 - 3.6.2 - Persistent EventHandler XSS# Google Dork: "inurl:"sites/all/modules/ckeditor" -drupalcode.org" # Google Results: Approximately 379.000 results# Date: 18th January 2012# Author: MaXe @InterN0T (Found in a private Hatforce.com PenetrationTest)# Software Link: http://ckeditor.com/ & http://drupal.org/node/1332022# Version: 3.0 - Current 3.6.2 (Drupal module: 6.x-1.8)# Screenshot: If attached, see image file.# Tested on: Windows + FireFox 8.0 & Internet Explorer 8.0 Drupal CKEditor - Persistent / Stored Cross-Site ScriptingVersions Affected: 3.0 - 3.6.2 (Developers confirm all versions since 3.0are affected.)Info:CKEditor is a text editor to be used inside web pages. It's a WYSIWYGeditor, whichmeans that the text being edited on it looks as similar as possible to theresults usershave when publishing it. It brings to the web common editing featuresfound on desktopediting applications like Microsoft Word and OpenOffice.External Links:http://ckeditor.com/http://drupal.org/node/1332022Credits: MaXe (@InterN0T) - Hatforce.com-:: The Advisory ::-CKEditor is prone to Persistent Cross-Site Scripting within the actualeditor, asit is possible for an attacker could maliciously inject eventhandlersserving java-script code in preview / editing in html mode.If an attacker injects an eventhandler into an image, such as"onload='alert(0);'",then the javascript will execute, even if the data is saved and previewedin editingmode later on. (The XSS will only executing during preview / editing inhtml mode.)If an administrator tries to edit the comment afterward, or is logged inand browsesto the edit page of the malicious comment, then he or she will execute thejavascript, allowing attacker controlled code to run in the context of the browser.Proof of Concept:Switching to "raw mode" in CKEditor and then writing: <p><img onload="alert(0);"src="http://1.images.napster.com/mp3s/2348/resources/324/363/files/324363272.jpg"/></p>Will become this when it is saved: <p><img data-cke-pa-onload="alert(0);"src="http://1.images.napster.com/mp3s/2348/resources/324/363/files/324363272.jpg"data-cke-saved-src="http://1.images.napster.com/mp3s/2348/resources/324/363/files/324363272.jpg"></p>If one searches for alert(0); in Firebug after the code has been injectedand executed, the location of the script will be:$full_url_to_script/event/seq/4/onloadWhere $full_url_to_script is e.g. the following:http://localhost/drupal/drupal-6.22/?q=comment/edit/3/event/seq/4/onloadThe content of this script is:function onload(event) {alert(0);}As there is a HTML filter in Drupal, it does not matter whether the <img>tag is allowed in this case, as it was possible to execute the eventhandlereither way. (And even store the data.)-:: Solution ::-There is currently no solution, as it's not a critical bug according todevelopers. See comments at: https://dev.ckeditor.com/ticket/8630 for moreinformation.At the same page there is an unofficial patch that should fix the problem,however it seems that it will not fix the bug in Chrome.Disclosure Information:6th December 2011 - Vulnerability found during a privatehttp://www.hatforce.com Penetration Test7th December 2011 - Researched and confirmed the vulnerability4th January 2012 - Reported to Drupal and CKEditor viahttp://drupal.org/project/ckeditor and http://dev.ckeditor.com/ andhttp://cksource.com/contact18th January 2012 - Developers of CKEditor has been contacted severaltimes, nothing has happened in two weeks and the advisory has beenavailable to the public via bugtrackers. Vulnerability released to thegeneral public.Sursa: Drupal CKEditor 3.0 - 3.6.2 - Persistent EventHandler XSS Quote