News for hackers. Stuff that matters.
Re:CSRF in Doorkeeper OAuth2 gem by lmm on Wednesday December 17, 2014 @07:26AM (#8762038)
Any sufficiently advanced vulnerability scanner contains an contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of a type system.

Seriously, the solution isn't better scanners or better tests, it's better languages. Make whether something is taking a potentially-destructive action part of its type, and then the compiler ensures that all such routes are appropriately protected; you can do this today in e.g. Spray (which I'm using in production, so this is not some ivory-tower theoretical solution).

Re:CSRF in Doorkeeper OAuth2 gem by dsacco on Wednesday December 17, 2014 @08:41AM (#8762234)
This suggestion eliminates bugs that are introduced by unsafe typing, sure. But race conditions, logic flaws, misconfigured tools and almost every class of web vulnerability wouldn't be eliminated just by implementing this.

Most vulnerabilities do not derive from a single faulty tool or framework, but the incorrect combination of several (faulty or not!) tools over a sufficiently large attack surface.

Re:CSRF in Doorkeeper OAuth2 gem by lmm on Wednesday December 17, 2014 @09:19AM (#8762330)
> This suggestion eliminates bugs that are introduced by unsafe typing, sure. But race conditions, logic flaws, misconfigured tools and almost every class of web vulnerability wouldn't be eliminated just by implementing this.

How often are security flaws a subtle, complex thing that couldn't have been caught by a sensible type system? Almost all of the flaws we hear about, at least here, are the really simple dumb mistakes that a better language absolutely would have caught.

Re:CSRF in Doorkeeper OAuth2 gem by rudolf0 on Wednesday December 17, 2014 @11:00AM (#8762723)
Do you mean a language with a very strong type system like Haskell, where you could create a web framework in which things like user input have different types associated with them? Those can offer some real advantages by never mixing untrusted input with page output and various calls to other systems.

But you don't get a lot of web application security advantages when you compare, say, Python and Java.

Of course, a very weak type system like PHP's can definitely introduce additional security flaws.

Re:CSRF in Doorkeeper OAuth2 gem by jfoutz on Wednesday December 17, 2014 @02:02PM (#8763684)
A common pattern (at least getting there) in Scala/F#/Haskell is to have paired types, UserInput and ValidatedUserInput. All the business logic requires the Validated kind. A programmer can be certainly be lazy and just return the supplied value, but this is a conscious choice to do the wrong thing.

You can't accidentally forget to validate form parameters. It won't compile. This is pretty easy to do in Java. On the weaker side, I would assume php and python have something like perl's taint mode. It's such a simple thing and it avoids so many xss problems.

Re:CSRF in Doorkeeper OAuth2 gem by lmm on Thursday December 18, 2014 @10:42AM (#8767742)
I'm mostly comparing with Scala because that's what I use most of the time. But even in Java it's very possible to get the same safety advantages - it's just that working with that level of type detail gets extremely cumbersome, so for most projects it's not worth it.
Re:CSRF in Doorkeeper OAuth2 gem by kofalt on Wednesday December 17, 2014 @10:16AM (#8762527)
Agreed. I try to explain sometimes that I'm merely tired of experiencing the same problem, over and over, for years.

I would like to experience the next problem, please. If only for variety's sake.

Re:CSRF in Doorkeeper OAuth2 gem by JoachimSchipper on Wednesday December 17, 2014 @11:07AM (#8762746)
Types are not that useful for security - it's as easy to create a MutatingController in Ruby as it is to concatenate some strings containing SQL and a string containing raw input in Haskell.

Better typing can help, and Ruby programs are more likely to be "stringly typed" than Haskell programs in practice - but the difference is a lot more subtle than one might expect.

Re:CSRF in Doorkeeper OAuth2 gem by mej10 on Wednesday December 17, 2014 @12:16PM (#8763103)
The issue is that Ruby can't give you the tools you need to catch such things before runtime. Haskell can.
Re:CSRF in Doorkeeper OAuth2 gem by michaelmior on Wednesday December 17, 2014 @07:39AM (#8762066)
Assuming the application code is completely secure, then that's a big part of the problem solved. But there's also the application server and any other services running on the machine hosting it.
Re:CSRF in Doorkeeper OAuth2 gem by lmm on Wednesday December 17, 2014 @09:17AM (#8762324)
So what, we give up entirely?

Most times I'm aware of a site being hacked it's been through a hole in their application code, not the stack they're running on top of.

Re:CSRF in Doorkeeper OAuth2 gem by michaelmior on Wednesday December 17, 2014 @09:27AM (#8762354)
I was not suggesting we give up entirely. I'm just pointing out that it isn't a complete solution of the problem. But I agree that application code is probably the bigger problem to solve.