• Oxford: +44 (0)1865 877830 
  • Manchester: +44 (0)161 713 0176 
  • Edinburgh: +44 (0)131 541 0118 
  • New York: +1 646-781-7580 
  • Bucharest: +40 316 301 707 
  • Tokyo: +81 (3) 4588 8181 

CKEditor Drupal Module Cross Site Scripting

You are here

23

Jan

CKEditor Drupal Module Cross Site Scripting

While doing a regular web application penetration test for one of our clients, I found a reflected cross site scripting in a very popular application, CKEditor, and more precisely in the module that this application has for Drupal. It was sort of curious, because the vulnerable page was actually the one in charge of checking for this kind of vulnerabilities! A detailed description of the issue, affected version, and other important information can be found in the following Drupal security advisory:https://www.drupal.org/node/2357029.

As a quick summary, it is important to emphasise that <script> tags are intentionally allowed by the CKEditor module, as there is a function named "filter_xss" which is used to deal with XSS attacks that CKEditor can't deal with. CKEditor is able to handle the <script> tag and hide it in WYSIWYG mode. The real source of the problem is the value of the third argument in the "drupal_valid_token" function, which for some reason was set to TRUE back in 2012. If this argument was set to FALSE the attack would not work, as the token check would protect the victim from any form submissions from external websites. in the vulnerable versions, the attack works for anonymous users as the token validation is skipped.

A proof of concept example is the specially crafted POST request shown below, made to the following CKEditor related page: www.example.com/ckeditor/xss:

POST /ckeditor/xss
text=<script>alert('XSS')</script>&input_format=filtered_html&token=<token>

After a stretch collaboration with the CKEditor main maintainer and a few guys from the Drupal security team, the issue was fixed and a patch was released.

Posted by Antonio

Leave a comment