Feed aggregator

Drupal core announcements: Drupal 8 theme system critical issues sprint (June 5-7 in Portsmouth, NH)

Planet Drupal -

Join us at the NHDevDays 2 sprint in Portsmouth, New Hampshire June 5-7.

The sprint will be focused on resolving the two remaining theme system criticals around autoescape and SafeMarkup:

Thanks to funding from the Drupal Association via Drupal 8 Accelerate to cover travel expenses two of the Drupal 8 theme system maintainers – joelpittet and Cottser – will be in attendance leading the sprint and providing guidance.

We recommend you have Drupal 8 installed before the sprint and if possible have some experience working on Drupal core (attending core contribution mentoring hours would be a great way to get a kick start!).

The theme system maintainers will be giving a brief overview of text sanitization and autoescaping in Drupal 8 and you will learn more about working with the theme layer in Drupal 8.

We also welcome remote attendees, join us in #drupal-twig and RSVP – there is a remote sprinter option when registering.

For more details and to register see the event in the Boston regional group.

Blink Reaction: I Survived Drupalgeddon

Planet Drupal -

I Survived Drupalgeddon: How Hackers Took Over My Site, What I Did About It, And How You Can Stay Safe

This is a recap of our session from Drupalcon 2015 in Los Angeles.

About 6 months ago, the Drupal security team announced one of the worst bugs in the history of Drupal. The recovery period has been very challenging for our community, though I think it's safe to say now that the storm has passed.

One of my personal sites, http://whaleocalypse.com/, was affected by the attack. I've been able to verify that the attack I experienced was the same attack that an overwhelming majority of Drupal sites experienced. What follows is a comprehensive post-mortem on that attack, including how it was done, and how you can ward off similar attacks.

A couple of disclaimers before I begin. First, I'm going to confess to some very insecure practices on whaleocalypse.com. Understand that whaleocalypse is a play thing, I knowingly took huge risks with that site because I had nothing at stake if it was lost. Quite honestly, I was pretty excited to learn that this disposable site been hacked because it gave me the opportunity to learn more about security. I would never take these same risks with my professional client work.

Second, and perhaps more importantly, I'm going to reveal how this hack was pulled off in very, very specific detail, including a large amount of fully functional exploit code. Checkout the code on Github. If at any point you feel yourself going "Hey, you're telling people how to hack my site!" I'd invite you to stamp that feeling down. If you are still vulnerable to any of the techniques described here, I'm sorry to say, you were already hacked weeks ago.

Table of Contents How This Hack Works Video Explaination #1  

The problem lies in database.inc, specifically in the function expandArguments(). Note lines 739, 745, and 755 in that file. It might be a little hard to follow, but the gist is that Drupal trusts the value of $i on 739 without sanitizing it. This is a problem because, in the case of the user login form, $i is generated based on the name attribute of the html <input> element.

Which means this hack just so, so, so easy to pull off:

Using this vector, I trivially worked up a little drupalgeddon client that will allow me to inject complex SQL statements into any vulnerable site.

Here it is in action:

Checkout Stephan Horst's examples to get a broader sense of what's possible with this bug.

How This Hack Works in the Wild

It's all well and good to talk about the theoretical danger presented by this bug. What I want to know is: how was the bug actually used in the real world by the real hackers who broke into my site. In order to answer this question, I spent a great deal of time examining the exploit files left on my server, and reverse engineered the tools that would have been used to create them. Check it out on Github.

I want to note here that, according to data released by Acquia 68% of hacking attempts in the first week of druppalgeddon were of the variety I'm going to describe here. The second most common attack style—adding a new admin user—accounted for 26% of all attacks. The user add style of attack is well understood, so I won't go over it here.

The attack that I, and most drupal site owners, experienced I'll call the "menu_router" attack. It works as follows:

  1. Create a new entry in the menu_router table whose "access_callback" is file_put_contents and whose "access_arguments" are a filepath and the contents of a file. This creates a new page in drupal to the effect of http://example.com/backdoor, where "backdoor" is a random string.
  2. Visit the new exploit page http://example.com/backdoor. When Drupal checks to see if the user should have access to the page, it will run file_put_contents('path/to/backdoor.php', '<?php //contents of attack file here ?>'). This creates a backdoor file which allows the attacker to execute any PHP on your server.
  3. Using the newly created backdoor.php, run some code which will make a request to another server and download a secondary attack file. This secondary attack file is a file upload form. It gives the attacker the ability to upload any file to your server.
Video Explaination #2

Also, here's another video overviewing the whole exploit kit, and the defense kit.

 

Video table of contents:

Step 1: Inject the SQL into the menu_router table

Using some strategy akin to the SQL injection tool I showed above, the hacker would have inserted a new row into the menu_router table. That row looked like this:

How to Defend Against This: Drop All POST Traffic in Varnish

If you haven't yet, UPGRADE TO DRUPAL 7.32 OR HIGHER. If you are reading this, and you are running a Drupal site on version 7.31 or lower, your site has already been hacked, probably several times by many different individuals.

That said, this is a good opportunity to harden your site against all SQL injection. If your site has a handful of logged in users, and serves mostly anonymous traffic, one precaution you can take is simply rejecting all POST data in Varnish—almost all SQL injection vectors will make use of POST traffic. You can do this trivially in your VCL file like so:

Site administrators can still login by visiting Apache directly on its new port, which is now 8000. You'll prevent non-administrators from visiting Apache directly by using an IP access control list in your Drupal .htaccess file. To accomplish this, simply prepend the following to your htaccess file:

Now, when a hacker tries to POST to your site they'll get an error:

See: Defense Procedure 1 at 22:20 in my video above.

Step 2: Create a backdoor that allows you to run any PHP

Now that we've created our menu_router entry, it's time to visit our new page. When we do so, a new file will be created.

As soon as the attacker visits this page, assuming your file system is writable, the following file will be created:

I spent a long, long time staring at this file during my post mortem. It was finally this comment on drupal.org that cracked the case for me. Can you tell what it does? Spoiler alert! It's a backdoor that allows the attacker to run any PHP code. Once this file is installed on your server, all the attacker has to do to execute PHP is send an HTTP request like so:

GET /modules/poll/zkwv.php HTTP/1.1 Host: exploited.com Cookie: Kcqf3=base64_decode; Kcqf2=["preg_replace", base64 encoded]; Kcqf1=[any PHP, base64 encoded]

I've reversed-engineered a deobfuscated version of it, to make the inner logic visible:

How to Defend Against This: Set Proper File Permissions

Its worth noting here, that the most common attack seen during Drupalgeddon would have failed on any site that had set proper Unix file permissions. If you haven't already, you can do so automatically with this script. See Defense Procedure 2 at 29:00 in my video above.

Step 3: Create a backdoor that allows you to upload files

Now the hacker has the ability to run any PHP on your server. And of course there's a great deal of damage that is possible with that power, but I've been able to determine what this hacker actually chose to do with this power. In addition to the arbitrary code execution backdoor I demonstrated above, I found several attempted backdoors. The most telling was this one, which I found inside the locale module:

Note, that is not my 404 page, that is the attacker's 404 page. Which means my server tried to execute some code intended to download a file. Which also means that we can go and see what file the attacker was trying to download:

I recognize this file! All told, I found four copies of this file on my server, and two copies of 404 pages in which the attacker attempted to download this file. When you compile it into HTML it's an uploader page, which will allow the hacker to upload any file to your server:

So not only do I now know what code this attacker executed and what it was for, I know the name of the town in Romania where he or she is from

How to Defend Against This: Upgrade to PHP 5.5.0

Remember, this is the second of two backdoors the attacker is going to install, and it is wholly dependant on the success of backdoor number 1 (which gave the attacker arbitrary code execution). Backdoor #1 is wholly reliant upon a weakness in preg_replace which allowed you to evaluate the haystack as PHP. This weakness was removed in PHP 5.5.0.

So while the attacker might still get backdoor #1 installed, they won't be able to use it, and they will not be able to create backdoor #2.

Putting it All Together

Considered together, you come up with a script like this. This is my best guess at the script this hacker actually used to attack my site. Once a hacker has executed this script against your site, he or she will be able to inject any SQL into your database, run any PHP on your server, and upload any file to your server.

Why create all these backdoors?

OK, if I may speculate wildly for a moment: this attacker was not interested in changing any content on my site. They didn't deface the homepage, or use my server for spam as far as I can tell. All they did was install obscure backdoors with random file names. So if I had to guess, the goal of this particular attack was to compile a large database of backdoored sites, and then sell the database. So maybe eventually this could have been used to steal data, but that doesn't seem to have been the direct goal of this particular attacker.

Was This Really Drupalgeddon?

In a word, no. A two words, not hardly. In a gif:

Let's just review some facts:

  • Anyone hosted on Acquia, Pantheon, Blackmesh, or Commerce Guys Platform.sh was safe, whether or not they patched.
  • Anyone who's file system was unwritable to Apache was safe from the most common attack.
  • Anyone running php 5.5.0+ was safe from the most common attack.

 

The discussion of this bug has so far centered largely on it's potential for damage. And, fine, I admit in theory this could have been really bad. But here in the world where we actually live, it's just impossible not to notice—nothing bad really happened. I've read lots of cases of hackers creating fraudulent users and uploading backdoor files, but I have yet to find—despite considerable effort—a single person blogging about a `DELETE FROM node` attack. As I learn more and more about this bug, I am increasingly persuaded that such an attack did not occur.

As Stéphane Corlosquet wrote on the acquia blog, across tens of thousands of (failed) hacking attempts, none were destructive, or even visible to the end user:

We could not find any query intended to change the content or destroy sites: attackers were only interested in installing backdoors to take over the site or server at a later point in time, and make the intrusion unnoticeable.

So just a casual suggestion among friends, but maybe we should stop analogizing this bug with the literal end of humanity and start regarding it as what it was: another day in the life of a sysadmin.

How I Recovered

TL;DR I restored from backups. Blair Wadman gives a pretty good overview of what it takes to secure your server, but briefly I:

  • Used the drupalgeddon tool to check for exploit files (it found all of them, by the way).
  • Copied my whole codebase from the server down onto my desktop and diffed them against the last known good version in git (this is how I know the drupalgeddon tool worked).
  • After 360 days and 5 hours of continuous uptime, I re-installed Linux from scratch. It's a good thing too, because I've been meaning to patch the shellshock vulnerabilty (lol).
  • Deployed my local backups to the new server.

In Conclusion

I just want to close by saying that I think this security event could have been a lot worse. The big Drupal hosting providers were patched before the vulnerability even became public, so very few high value Drupal targets were hit. Of the Drupal sites that did get hit, the most common attack seems to have been pretty innocuous. This is a case where open-source worked more or less as it's supposed to; more eyeballs on the problem brought an incredibly obscure bug to light, and let us fix it—whereas a closed source product would have kept chugging along with the vulnerability unpatched. While this has not shaken my faith in Drupal as a whole, it has made me sit up and take security a little more seriously.

References DrupalBest PracticesDrupal How toDrupal PlanetLearning SeriesTechnology ToolsPost tags: DrupalgeddonDrupalDrupalconDrupal Secuirty

DrupalCon News: Front end branches out to inspire and excite

Planet Drupal -

It’s almost that time of the year, where we get the Drupal community together in Europe to celebrate and share amazing stories. In Front end we are coders, designers, and sometimes both. We build themes, work with developers, designers, project managers, content strategists, marketers and clients. We are looking for a mix of topics that will inspire and excite us.

The Front end track will have 13 sessions and we would like to cover the following topics:

Drupal core announcements: Formal usability testing of Drupal 8 at the University of Minnesota Usability Lab, 22nd–25th June

Planet Drupal -

On the 23rd–25th of June, just before Twin Cities Drupal Camp, we will be conducting usability testing focusing on Drupal 8 at the University of Minnesota. This is a great opportunity to evaluate the current state of Drupal 8 and identify issues that can be resolved before release, or require much of our attention after release.

We'll start on fixing items found during the Twin Cities DrupalCamp Sprints and continue throughout Drupal 8's release cycle.

The University of Minnesota's Usability Services Department has been an amazing long-time supporter of the Drupal project. Hosting us in 2008 just after Drupal 6's release for the first-ever Drupal formal usability study, and again in 2011 just after Drupal 7's release. These usability test results have been invaluable in shaping Drupal's user experience over the years.

What will we be testing?

The tasks for this study will varied and focused around both content creation and site building activities:

  • Mobile content creation experience
  • Content authoring (preview, menus, in-place editing)
  • Layout modeling (placing blocks and editing blocks)
  • Content modeling (Field UI, Views)

We will be inviting users with a technical background, of which at least half have experience with Drupal 6/7.

The findings will be presented at Drupalcamp Twin Cities (and hopefully in addition, DrupalCon Barcelona), and all the corresponding issues will be tagged with UMN 2015.

Your help is needed!

We are close to release thus we have a small window of opportunity to fix these problems before Drupal 8 is released.

  • Review the test script (should be ready next week, to be finalized by June 15).
  • Help find and fix any major user-facing bugs prior to Beta12 (June 17) that will get in the way of users completing the test script. File these under the UMN 2015 prep tag.
  • Attend the usability testing, either in-person or remotely (see below).
  • Contribute during the Twin Cities DrupalCamp sprint (in-person or remotely in #drupal-usability) to translate problems that were found into actionable Drupal core issues.
  • Provide solutions/reviews to the identified issues with the UMN 2015 tag.
Attending the sessions

While space is limited, we are able to accommodate some community members who wish to attend the usability testing sessions either in-person or remotely (over WebEx). In case you are interested please get in contact with Lewis Nyman.

We know that experiencing a usability are quite transformative, and hope that anyone interested reaches out. Sadly, the sessions will not be fully open - as we wish to respect our participants' privacy. Attendees will be required to sign the University of Minnesota Usability Lab's Code of Conduct in order to ensure the privacy of testing subjects is upheld.

We are very excited about learning more about our users and Drupal, and hope to share the results with you as soon as possible!

Yay!

Mediacurrent: Introducing Metatag 1.5

Planet Drupal -

One of the most commonly used modules for helping with a Drupal 7 site’s SEO is Metatag. A rewrite of the Drupal 5 & 6 module Nodewords, Metatag provides a flexible system for customizing the meta tags used on a website. Using various meta tags it is possible to exert some control over how search engines analyze each page, and how the content looks when it is shared over social networks.

Midwestern Mac, LLC: DrupalCamp St. Louis 2015 - register now, come help at our first-ever sprint day!

Planet Drupal -

DrupalCamp STL.15 (June 20-21, in St. Louis, MO) will be the first DrupalCamp in St. Louis with a day dedicated to sprints to help the Drupal community. We're expecting a great turnout, and there are already a number of proposed sessions (many of which will be selected and announced on June 5!), and it's not yet too late to propose a session of your own!

This year's keynote, by Alina Mackenzie, will focus on the Drupal Community—what it is, why it rocks, and how you can get involved in the community. After the keynote, some great sessions, a tasty lunch, happy hour, and a good night's rest, we'll spend sprint day (Sunday June 21) making Drupal better, and maybe even pushing Drupal 8 a little closer to an 8.0.0 rc1 release!

Registration is now open, so go reserve your spot at DrupalCamp St. Louis 2015; I'll see you there, hopefully at one of the sessions I proposed, either on High Performance Drupal, or Local Development Environments and Drupal VM!

Arthur Foelsche: One click deployment? How about one push?

Planet Drupal -

Yes, yes, one click deployment is amazing. And yet so last year. So I say, hell no, we want one push deployment. The dream cheeky USB button is neat. Let's deploy sites with it. This project is an example of how you might be able to do it: Deploytron.

Ok, so what does this really mean? With virtualized development environments, continous integration tools, and continous delviery tools we should be able to make changes to production sites predictably and easily. Deployment isn't an after thought, it's simply another step in the development process. And its easy. Hosting services are marketing tools to do specifically this. But frankly, it takes the fun out of it. 

You should be able to launch a site with some fan fare. Deliver a Deploytron box to your client and let them hit the button. Put names in a hat and let somebody in the office press the button. See how long it takes your cat to step on it. 

Categories: Planet Drupal

Moderating Content with Revisioning Module - Follow Up

Twin Cities Drupal Group -

Hey Guys -

I wanted to let you all know that I went back and carefully reviewed my settings for the revisioning module in order to get the published content viewable to anonymous users.

I updated my slides to reflect the correct settings. (Yes, I know we didn't look at slides - I didn't feel like making people dizzy by switching screens around too much.)

AttachmentSize Moderating_Content.pptx_.pdf1.1 MB

Forum One: Participating in the Drupal Community

Planet Drupal -

Recently, I had the opportunity to present my core conversation,”Pain points of learning and contributing in the Drupal community,” at DrupalCon Los Angeles.

My co-presenter Frédéric G. Marand and I talked about the disconnect between Drupal and api.drupal.org on core and some of the pain points to contributing and learning in the Drupal community. We also spoke little bit on continuous contribution and sporadic contribution and benefits of both.

The open mic discussion brought up some interesting issues, and so I have compiled some links to answer questions.

Audience Suggestions and Responses

  • Stable release of Drupal 8 will help people start on client work and support contribution. The Drupal community needs to recognize contribution not just in the form of patch, but mentors mentoring on IRC during core office hours, credit to code reviewers on the issue queue, recognize event organizers and have people edit their profile on Drupal.org and list their mentors at the end of a sprint.
  • Make profiles better on Drupal.org. Here is an issue for that – [Meta] new design for User Profiles.
  • Event organizers could get an icon on their profile page. You can read more on that – Make icons for the items in the list of user contributions to be included on user profiles
  • Another issue to read – Reduce Novice Contribution differences and consolidate landing pages, content, blocks
  • Explanations of what needs to be done could be a big time-saver. For Drupal 8 there are pretty clear outlines of what could be done for core.
    • There was a suggestion to provide video and audio documentation instead of just text, walking people through issues. There are four or five companies that make videos and we have core office hours for walking people through the issue.
  • A few people expressed that its hard to keep up with IRC and are looking for easier ways to communicate. I have created an issue for that and you can read more here – Evaluate whether to replace Drupal IRC channels with another communication medium.
    • Another audience member suggested that we need to make sure that communications that happen in IRC are summarized and documented on issues so more people can get familiar with the discussion.
    • There were some suggestions for core mentoring that have been proposed but haven’t panned out such as twitter or hangouts (privacy concerns, less office-friendly)
    • Someone suggested that those who don’t like to get on IRC, can get core updates via email (This week in Drupal Core) which is a weekly-to-monthly update on all the cool happenings in Drupal 8
    • Users can also subscribe to issue notifications in email on the issues/components they want to follow on Drupal.org.

Overall it was an enlightening core conversation and it was amazing to hear from the community about their pain points and suggestions they made.

To see more of our discussion watch the presentation and view the slides.

Trellon.com: How Drupal.org is lowering the barrier to become a module maintainer

Planet Drupal -

Before anything else, I want to point out that while this post will focus on maintaining a contrib module on drupal.org, that is just one of the many ways to contribute to the Drupal project. Every contribution is important whether it's a core patch, a documentation edit, a translation, or something else. If you use Drupal, please consider how you might be able to give back to the community. If you're already contributing, then thank you!

Acquia: Drupal replaces in-house CMS at Digital Agency - meet John Doyle

Planet Drupal -

Language Undefined

In April 2015, I was excited to talk with John Doyle, General Manager Technology & Solutions Architecture at the Australian full-service digital agency Komosion, to explore their decision to adopt Drupal to replace other technologies, including an in-house CMS they'd invested 10 years of work in. In this podcast, John very clearly lays out what Komosion's priorities were in making this decision, the benefits for the agency and its clients, and the future he sees using Drupal as the basis for future work.

Drupal core announcements: Recording from May 29th 2015 Drupal 8 critical issues discussion

Planet Drupal -

It came up multiple times at recent events that it would be very helpful for people significantly working on Drupal 8 critical issues to get together more often to talk about the issues and unblock each other on things where discussion is needed. While these do not by any means replace the issue queue discussions (much like in-person meetings at events are not), they do help to unblock things much more quickly. We also don't believe that the number of or the concrete people working on critical issues should be limited, so we did not want to keep the discussions closed. Here is the recording of the first meeting from today in the hope that it helps more than just those who were on the meeting:

Unfortunately not all people invited made it this time. If you also have significant time to work on critical issues in Drupal 8 and we did not include you, let me know as soon as possible.

Cocomore: Awesome DrupalCamp Spain 2015 in Jerez!

Planet Drupal -

Last week, some colleagues from Cocomore and I attended DrupalCamp Spain 2015. Spanish Drupal community is awesome, and they have put all their efforts in making an unforgettable event again in this 6th edition (the 5th I have attended).

The event was divided into different activities for the three days: Business Day and Sprints on Friday, and sessions on Saturday and Sunday.

read more

Awesome DrupalCamp Spain 2015 in Jerez!

Drupal Fire -

Cocomore (via DrupalFire)

Last week, some colleagues from Cocomore and I attended DrupalCamp Spain 2015. Spanish Drupal community is awesome, and they have put all their efforts in making an unforgettable event again in this 6th edition (the 5th I have attended).

The event was divided into different activities for the three days: Business Day and Sprints on Friday, and sessions on Saturday and Sunday.

read more

Pages

Subscribe to Cruiskeen Consulting LLC aggregator