Brightbox
  • Home
  • Pricing & Signup
  • Why Brightbox?
  • FAQs
  • Services
  • Blog
  • Wiki
  • Forums
  • Support
  • About
  • Contact
Blog RSS feed
POSTED BY

Rahoul Baruah

rahoul@brightbox.co.uk

twitter_banner

Recent Posts

  • "Carbon Neutral" Rails Hosting
  • Brightbox SAN storage quotas doubled!
  • Sphinx Ubuntu Package
  • New feature: MySQL slow query log
  • The Big Brightbox Bandwidth Bonanza (up to 220% more!)

Rails CSRF Security Vulnerability 19 Nov 08

Users of Rails 2.1 and 2.2 need to be aware of a vulnerability in Rails’ CSRF forgery protection.

For those that don’t know, Rails generates an authentication token within your forms and verifies this token when the form is submitted back to your application. This prevents attackers from crafting malicious requests whilst pretending to be your authenticated user.

However, for certain types of request (supposedly those that cannot be generated from a browser) this authentication token is ignored - in order to make it simpler for automated API access to your application (using JSON, XML or a few other data transport types). Unfortunately, text/plain is wrongly included as one of these types.

Luckily, the fix is simple. The long-term solution is to upgrade your application to Rails 2.1.3 or 2.2.2 (when they are released); the quick fix is even easier - tell Rails to verify text/plain requests by creating a file (called mime_type_csrf_fix.rb) in your config/initializers folder:


# temporary fix for http://www.rorsecurity.info/journal/2008/11/19/circumvent-rails-csrf-protection.html
Mime::Type.unverifiable_types.delete(:text)

Posted 19 November 2008 by Rahoul Baruah

csrf+ rails+ rails 2.1+ rails 2.2+ security

1 Comment

  1. 1 month ago 3hv » Blog Archive » Rails 2.1 and 2.2: CSRF vulnerability and work-around said:

    [...] I’ve done a quick write-up on the recent CSRF vulnerability on the Brightbox blog. [...]

Post your comment


Recent blog posts

  • “Carbon Neutral” Rails Hosting
    13 days ago
  • Brightbox SAN storage quotas doubled!
    20 days ago
  • Sphinx Ubuntu Package
    22 days ago
  • New feature: MySQL slow query log
    26 days ago
  • The Big Brightbox Bandwidth Bonanza (up to 220% more!)
    28 days ago
  • The Passenger™ Masterplan
    29 days ago

Join our email list

Flickr (more...)

RSS feeds

Blog feed

Flickr feed

Recent Wiki updates

System Status feed




Brightbox Partners and Vendors

Wiki | Forums | Terms & Conditions | Privacy | Site map

Copyright © 2008 Brightbox Systems Ltd. All rights reserved