what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Drupal 8.0.0 Beta 14 Cross Site Scripting

Drupal 8.0.0 Beta 14 Cross Site Scripting
Posted Oct 8, 2015
Authored by Sandeep Kamble

Drupal version 8.0.0 Beta 14 suffers from a cross site scripting vulnerability. Drupal's sad fix was to simply throw an .htaccess file in place to block access to the file.

tags | exploit, xss
SHA-256 | 5bd347c6e00b7474b1898520fa6e4c484efeb9fdb98a576944cad1bd5ccda41a

Drupal 8.0.0 Beta 14 Cross Site Scripting

Change Mirror Download
*Overview*

Recently, I was playing around with the Drupal CMS application code. Drupal
is an open source CMS application widely used for blog posting purpose,
Further details, to know more about Drupal
here <https://www.drupal.org/documentation>. Open source application
advantage being, the source code was at my disposal.

While fiddling around with the core Drupal Vendor Package I stumbled upon a
very interesting vulnerability of XSS. Now the idea was to see how exactly
an attacker can exploit this particular XSS to impact Drupal users at large.
So let me walk you through the technical process of discovery and impact
assessment for the Drupal source code audit which lead to the discovery of
XSS which can be used to hijack drupal accounts or to perform other
malicious activity by an attacker.

Post submission about the vulnerability details to Drupal, they added file
.htaccess protection (so-called-fix) which has been added to the vendor’s
directory that enables denying access to the following location,

Location of vulnerable file is :
\core\vendor\behat\mink\driver-testsuite\web-fixtures\issue130.php

The above file contains a PHP Super GLOBAL variable :
*$_SERVER[‘HTTP_REFERER’]* which fails to sanitize requested data, which is
specifically vulnerable to reflected cross site scripting attack.

*Reporting Date : *29th Aug, 2015 via BugCrowd


*Vulnerability Details: *

The source code audit started with the use of grep command.Initially, I was
more inclined towards finding specific set of keywords like $_GET, $_POST,
$_COOKIE, or $_REQUEST as well as other user provided inputs that can also
be operated with $_FILES, $_SERVER one by one.

So, after a number of unsuccessful attempts of GREP command, finally grep
-i -r “\$_SERVER” command did the thing for me!!

[image: drupalServer]
<http://blog.securelayer7.net/wp-content/uploads/2015/09/drupalServer.png>

*Figure 1 : grep command execution:Random output from the above code *

Here, we can see a number of results from our simple grep command
execution. Lets try for some more combinations to get a precise result as
compared to our earlier result.

Bingo!! here appears some interesting stuff, when I started digging deeper
into the pages to look for an un-sanitized data inputs from users. After a
while a specially crafted command, produced the desired valid result.

grep -i -r “\$_SERVER” * | grep “$_GET” | grep “echo” and here something is
fishy!!!.

[image: DrupalEcho]
<http://blog.securelayer7.net/wp-content/uploads/2015/09/DrupalEcho.png>


*Figure 2 : Finally,found some suspicious files which may be vulnerable. *

Giving my search a different angle I started looking for the following:
/core/vendor/behat/mink/driver-testsuite/web-fixtures/issue130.php and
guess what, we stumbled upon the following code.

<!DOCTYPE html>
<html>
<body>
<?php
if (‘1’ === $_GET[‘p’]) {
echo ‘<a href=”issue130.php?p=2″>Go to 2</a>’;
} else {
echo ‘<strong>’.$_SERVER[‘HTTP_REFERER’].'</strong>’;
}
?>
</body>



[image: DrupalCat]
<http://blog.securelayer7.net/wp-content/uploads/2015/09/DrupalCat.png>


*Figure 3 : At first glance this might look like a simple XSS to you. *

However, a closer look reveals the true nature of the beast!!

So, lets prepare a POC which will reveal the true nature of the beast ;).We
only had to send a referer header to the issue130.php with a XSS payload,
as shown in the following image.

[image: 7] <http://blog.securelayer7.net/wp-content/uploads/2015/09/7.png>

*Figure 4 : sending XSS payload using referer HTTP header *

Once this referer header is sent via the URL :
http://google.com<script>alert(1)</script>
then it will pop out an alert JS code execution. In the below image you can
see successful execution of the JS code.

[image: 6] <http://blog.securelayer7.net/wp-content/uploads/2015/09/6.png>


*Figure 5 : Successful execution of the Javascript code *

*Conclusion*

Official Drupal update regarding the patch for this vulnerability seems
unsatisfactory, since they have decided to use “.htaccess” as patch, which
is not a proper mechanism to patch away this XSS, no filter or encoders
have been used.However,several other mechanisms can be used for successful
filtering & encoding such as HtmlEncode, HtmlAttributeEncode,
JavaScriptEncode etc.
reference link:
https://msdn.microsoft.com/en-us/library/hh567599%28v=cs.95%29.aspx

https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet

​Reference :
http://blog.securelayer7.net/core-drupal-8-0-0-beta14-xss-attack/​

--
​Sandeep S. Kamble
SecureLayer7
http://securelayer7.net​


Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close