News for hackers. Stuff that matters.
Re:Security patch releases to Rails 2.3.x, 3.0.x by tptacek on Tuesday February 08, 2011 @09:29PM (#2195991)
* In mail_to :encode => :javascript, they weren't sanitizing email addresses, just catting them into the tag.

* There were using Enumerable#reject (ie, default allow) with a strict filter to decide which controllers/actions to route requests to, but case-insensitive filesystems aren't similarly strict.

* (Worst of all) ActiveRecord::QueryMethods#limit/limit_value wasn't sanitized while building queries (try Foo.limit("1,,0") for the flavor).

I don't know what the CSRF thing was either, but it looks like a headachey fix.

Re:Security patch releases to Rails 2.3.x, 3.0.x by rst on Tuesday February 08, 2011 @10:49PM (#2196197)
The Django blog has a description of the CSRF problem here: http://www.djangoproject.com/weblog/2011/feb/08/security/

Briefly, when both frameworks got an "X-Requested-With" header, they assumed that it was coming from a browser XmlHttpRequest, and that the same-origin policy was in effect. So, they skipped CSRF checks.

However, it turns out that there is a way (details still not disclosed, other than that plugins and redirects are involved) for an attacker to force arbitrary headers onto a web request. Ooops.

Both frameworks are now applying CSRF checks strictly, with no exceptions for apparent XHR.

Re:Security patch releases to Rails 2.3.x, 3.0.x by ubernostrum on Tuesday February 08, 2011 @09:32PM (#2196007)
Yeah, the CSRF thing is very much not happy time.
Re:Security patch releases to Rails 2.3.x, 3.0.x by nbpoole on Tuesday February 08, 2011 @09:35PM (#2196010)
http://code.djangoproject.com/changeset/15464/django/trunk/d...

Django released a similar fix. According to their changeset, we'll see a release from them shortly as well. Maybe they'll shed some more light on the issue.

Re:Security patch releases to Rails 2.3.x, 3.0.x by ubernostrum on Tuesday February 08, 2011 @09:46PM (#2196037)
Since I have the announcement right in front of me (I'm revising it in preparation for the final post), I can tell you there's not really any more detail in it than in the Rails post.

I don't know yet when the full full disclosure will happen; I just know that right now I'm really not at liberty to do that.

Re:Security patch releases to Rails 2.3.x, 3.0.x by nbpoole on Tuesday February 08, 2011 @09:50PM (#2196045)
Fair enough. I guess I'll just have to work it out for myself. :P
Re:Security patch releases to Rails 2.3.x, 3.0.x by tptacek on Tuesday February 08, 2011 @10:10PM (#2196086)
Re:Security patch releases to Rails 2.3.x, 3.0.x by nbpoole on Tuesday February 08, 2011 @10:16PM (#2196106)
That's not it, unless I'm missing something big.

Flash and Java both disallow cross-domain requests unless specifically allowed by a crossdomain.xml file (or you use a DNS rebinding attack on Java). Furthermore, to the best of my knowledge, if you can make an HTTP request in Java or Flash you can read back the result.

Re:Security patch releases to Rails 2.3.x, 3.0.x by emerose on Wednesday February 09, 2011 @02:38AM (#2196755)
I probably shouldn't have phrased that so definitively: I don't have any evidence that Flash is to blame here. In fact, given that this problem required a framework-level fix (rather than, eg, a simple patch from Adobe) I suspect that this affects a lot of things.

In my tweet, I just meant to say that Rails checked for something very simple: a header that Flash's addRequestHeader() can trivially fake out. As Neal points out, that can't be the whole story — but I suspect it's part of it.

Re:Security patch releases to Rails 2.3.x, 3.0.x by nbpoole on Tuesday February 08, 2011 @10:42PM (#2196181)
To be perfectly clear, Sam is not wrong. Flash and Java both let you issue requests with that header. However, if you try and make a cross-origin request, they'll both throw exceptions unless you have permission (in the form of a crossdomain.xml file). I assume that's where the redirects come into play, although I can't imagine how you redirect someone's POST request to a different domain.
Re:Security patch releases to Rails 2.3.x, 3.0.x by tptacek on Tuesday February 08, 2011 @10:45PM (#2196186)
I'm just messing with you both.

Resetting sessions on CSRF failures is going to suck for us.

Re:Security patch releases to Rails 2.3.x, 3.0.x by bonzoesc on Tuesday February 08, 2011 @11:59PM (#2196419)
Is there any reason to reset the session on a CSRF failure vs. just failing the request? Seems like you could have fun DOSing people from their sessions on other sites with that default behavior.
Re:Security patch releases to Rails 2.3.x, 3.0.x by nbpoole on Wednesday February 09, 2011 @12:28AM (#2196492)
That's right. Of course, without knowing more details about the vulnerability, it's hard to say whether there's a benefit to ending the session.
Re:Security patch releases to Rails 2.3.x, 3.0.x by emerose on Wednesday February 09, 2011 @02:16AM (#2196723)
I don't have any inside information on this, but my guess is that this is going to come down to confusion about 302/303/307 redirects. In theory, clients receiving a 302 in response to a POST are supposed to re-send the POST wherever the redirect leads; in practice, clients do all kinds of different things. This feels like just the kind of weird edge case that defeats fragile security mechanisms like crossdomain.xml.