Cracking Drupal - XSS en Anything you can do XSS can do better <p>Cross Site Scripting (XSS) is the number one vulnerability in Drupal code¹ and one of the scariest forms of exploits, because anything you can do XSS can do better².</p> <h3>More serious than &lt;script&gt;alert('xss')&lt;/script&gt;</h3> <p>During XSS demos and vulnerability testing it's easy to use some code like &lt;script&gt;alert('xss')&lt;/script&gt; to see Javascript executed where it shouldn't be. But an alert box isn't scary.</p> <p>It's scary when Javascript can put your Drupal site offline. And it's even scarier when it locks you out of logging back in because it changed your administrator account username, password, and email address. Watch the short video below to see a demo of this.</p> <p><iframe src="" width="400" height="300" frameborder="0"></iframe></p> <p>The malicious Javascript entered by the attacker, when unknowingly executed by an administrator, does the following evil evil things:</p> <ul> <li>Changes the site title and site email address</li> <li>Changes the administrator's username, email, and password</li> <li>Sets a site-offline message and puts the site in offline status</li> <li>And finally, logs the current user out of the site³</li> </ul> <h3>How do you protect against this?</h3> <p>Against this exact demo? You disable the use of the Full HTML input format by anonymous users. In general you should understand how to <a href="">configure your site securely</a> and know <a href="">what actions you allow untrusted users to perform</a>.</p> <p>The attack vector in the video is a comment that has Full HTML enabled for anonymous users. Note that Drupal <strong>does not</strong> come by default with Full HTML enabled for anonymous users.</p> <h3>Be mindful of contributed modules</h3> <p>It's also common that contributed modules print user-supplied data insecurely, opening up for an XSS attack. Popular modules are often more vetted and secure, and thus safer to use. Greg has written recently about some <a href="">tools to use in picking modules</a>. Also, if you're writing code, make sure you're <a href="">correctly using the APIs and following best practices</a>.</p> <p>Stay safe, community!</p> <p>¹XSS is the number one vulnerability in Drupal code based on times reported in Drupal core and contributed project Security Advisories as published by the Drupal Security Team. Read the <a href="">report on Drupal Security</a> for more information and stats.</p> <p>²Javascript can't exactly change admin settings better than you can :). It can certainly change it "faster" than you can though.</p> <p>³The final piece of the attack ran by the Javascript is actually a different class of attack known as Cross Site Request Forgery (CSRF).</p> Planet Drupal XSS Fri, 01 Oct 2010 05:25:55 +0000 Ben Jeavons 57 at Mitigation against CVE-2010-1584 Drupal Context Module XSS <p>Recently Justin Klein Keane posted information about a <a href="" rel="nofollow">vulnerability</a> in the <a href="">Context Module</a> for Drupal.</p> <p>Justin included information about mitigating factors:</p> <blockquote><p>In order to execute arbitrary script injection malicious users must have 'Administer blocks' permission.</p> </blockquote> <p>Here are some more concrete steps for mitigation of this particular vulnerability.</p> <h3>1. Ensure only trusted roles have the "Administer Blocks" permission</h3> <p>My coworker Ben Jeavons wrote previously in this blog about the importance of understanding <a href="">trusted and untrusted users on your site and how roles play in</a>. We also built a check for some important permissions into the <a href="">Security Review</a> module that Ben built as part of his work with <a href="">GVS</a>.</p> <p>To put it simply, while it's not on the list of roles that the Drupal Security Team considers to be <a href="">site owning permissions that mean there is no need for a Security Advisory</a>, <strong>"Administer blocks" is an important permission and shouldn't be given out to untrusted people who might <strike>inject XSS into a block title</strike> reconfigure or disable all the blocks from the site.</strong></p> <p><em>Update: <a href="">Heine Deelstra</a> asked me to clarify that last line. In general, injecting XSS into a block title would merit an SA in the opinion of the Drupal Security Team. Granular permissions are a strength of Drupal and only permissions which allow for privilege escalation are included in the list <a href="">we will not do an SA for</a>.</em></p> <h3>2. Upgrade Context to the latest code from the repository</h3> <p>As often happens, the Drupal community can move quite quickly and in this case <a href="">the issue has been fixed in the development version of code</a> that exists in the source code repository. A big thanks goes to <a href="">Steven Jones</a> and to <a href="">Young Hahn</a> - two of the volunteer module maintainers - for helping out in this particular case . <em>I say "volunteer" because Steven and Young are not paid by the Drupal Security Team to do this kind of work, though their employers may pay them for it, their employers are only one of many companies that benefit from the existence of the modules.</em></p> <p>To get the code from CVS a site administrator could use this single command:</p> <p><code><br /> cvs -d:pserver:anonymous:[email protected]:/cvs/drupal-contrib checkout -d context-DRUPAL-6--2 -r DRUPAL-6--2 contributions/modules/context/<br /> </code></p> <p>There is an issue to create a <a href="">development snapshot release for this vulnerable branch</a> so it would be easier to download the new code and that release will be created automatically by the Drupal packaging system within 12 hours.</p> <p><em>Update: a <a href="">new release</a> has been created.</em></p> <p>You should of course test an updated module in a test environment prior to releasing it onto a live site.</p> <h3>3. Disable the Context module</h3> <p>Only do this if you can't do steps 1 and 2. Really, both of those should be entirely possible and they are simpler.</p> <p>The Context module provides a variety of features, but the most common one is a new way to show blocks on a site. So, if you can live without the features provided by context you can simply disable it.</p> <p>Go to Administer > Site building > Modules and uncheck the checkbox next to the module and submit the form.</p> <h3>My personal commentary</h3> <p>My personal take on this is that it's been given a bit more hoopla than it deserves. The mitigation steps are simple and most sites would not be vulnerable in the first place. The Drupal Security Team has a policy of not creating "Security Advisories" in the case of Release Candidate (RC) software and, ideally, the broader world of "Security Researchers" would respect that.</p> <p>Of course, it would also be ideal if site administrators respected the "developer" nature of these kinds of modules, but the <a href="">project usage for Context</a> shows that it is on well over 10,000 sites. Another solution to that would be for module developers to create official "1.0" releases of their modules if they are serious about letting them get used on lots of sites.</p> <p>On a somewhat related note, the Verizon Security blog recently had a post about <a href="">Security Researchers vs. Narcissistic Vulnerability Pimps</a>.</p> Planet Drupal XSS Mon, 10 May 2010 18:04:36 +0000 greggles 55 at Drupal text filtering decision cheat sheet <p>This flowchart is based on the one that <a href="">Heine Deelstra</a> presented at Drupalcon Paris.</p> <p>I'm hopeful that the presentation will be helpful in eliminating <a href="">Drupal's most common security issue</a>!</p> <p><a href=""><img src="" /></a></p> <table id="attachments" class="sticky-enabled"> <thead><tr><th>Attachment</th><th>Size</th> </tr></thead> <tbody> <tr class="odd"><td><a href="">filtering_text.pdf</a></td><td>55.82 KB</td> </tr> </tbody> </table> cheat sheet Drupal security XSS Thu, 08 Oct 2009 16:39:54 +0000 greggles 34 at When a Security Vulnerability is Just a Bug - Drupal Content Access XSS <p>If you pay close attention you may have noticed a recent <a href="">disclosure</a> of an XSS vulnerability in the <a href="">Content Access</a> module.</p> <p>This report comes from a system administrator and security researcher at a <a href="">fine university</a> and contains a section titled Vendor Response:</p> <blockquote><p> Drupal security [team] was notified of this vulnerability on 5/19/2009. Vendor<br /> has declined to issue an official security announcement due to the<br /> restricted access rights required to carry out the proof of concept<br /> exploit. Vendor has filed a bug with the module maintainer at<br /> <a href="" title=""></a>. </p></blockquote> <p><!--break--><!--break--></p><p>XSS is a big deal! With XSS you can run any activity like <a href="">change a user's password</a>. A similar issue <a href="">exists in Drupal core</a>.</p> <p>However, the only way to exploit this vulnerability is to edit a role or create a new role, which is only possible for people with the permission to do a lot of other really bad things on the site much more directly than XSS.</p> <p>The Drupal Security team has to balance the desire to have vulnerability-free code with the desire to get every end-user updated to the most recent code. If there are dozens of new vulnerability reports and releases of core/modules all the time end users will start to ignore them - particularly when they are for things like this which aren't the most important concern within this scenario.</p> <p>Is that logic sound? Do we really have a noise/upgrade/"useless release" problem? Let's look at the numbers.</p> <h3>How quickly do Drupal site maintainers upgrade?</h3> <p>So, are we doing a good job of supporting people and getting them to upgrade their site and modules?</p> <p><img src="" /></p> <p>Sadly people are still very slow to upgrade. Screaming louder about security holes isn't going to help.</p> <p>There are lots of things we can do here. I've heard complaints that upgrading is too hard - it's too easy to break your site in the process. I've also heard complaints that "Well, I upgraded and then 2 weeks later a new release came out. So now I wait 2 weeks after every release to make sure I only have to do it once." I've also heard "there are so many releases and I don't understand them, so I just upgrade my sites periodically."</p> <p>Dang.</p> <p>So, as bullet points of what we can do</p> <ul> <li>Make upgrading as easy as possible (without sacrificing security...)</li> <li>Reduce unnecessary noise and confusion around SA</li> <li>Only make an SA/Release when it's absolutely necessary</li> </ul> <p>What else? Why don't you upgrade your sites? What could Drupal or the security team do to make you more likely to upgrade?</p> Cross Site Scripting Planet Drupal XSS Wed, 27 May 2009 14:43:14 +0000 greggles 21 at