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

Rahoul Baruah

rahoul@brightbox.co.uk

twitter_banner

Recent Posts

  • New: reboots and additional VM info in control panel
  • Passenger 2.2.4 packages for Ubuntu
  • New: 4GB Brightbox PLUS increased CPU on 1GB and above!
  • Ruby BigDecimal denial of service
  • Is it JRuby?

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. 7 months 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. [...]

Comments are now closed.


Recent blog posts

  • New: reboots and additional VM info in control panel
    3 days ago
  • Passenger 2.2.4 packages for Ubuntu
    5 days ago
  • New: 4GB Brightbox PLUS increased CPU on 1GB and above!
    15 days ago
  • Ruby BigDecimal denial of service
    24 days ago
  • Is it JRuby?
    about 1 month ago
  • New: Brightbox CDN (Content Delivery Network) service
    about 1 month 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 © 2009 Brightbox Systems Ltd. All rights reserved