News for hackers. Stuff that matters.
Re:Things to Use Instead of JSON Web Tokens by JimDabell on Monday May 08, 2017 @07:17AM (#14290665)
> Only if you completely bungle the implementation on the server-side.

Which happens with regularity. This is exactly what led to the vulnerabilities mentioned in the article.

This is a bit like arguing against the claim that generating SQL queries by concatenating strings is unsafe. "Only if you completely bungle escaping the parameters", right? As it turns out, that's an extremely common mistake. It's easier to use a known-safe practice like parameterised queries than it is to rely on developers avoiding this pitfall each and every time they have to execute an SQL query.

Likewise with this. We know that negotiating the algorithm is subject to mistakes, and it offers no benefits. So instead of relying on developers avoiding this pitfall each time, let's avoid the pitfall altogether and get rid of negotiation.

There's a human aspect to security that's being missed here. Saying what boils down to "well developers shouldn't write insecure code" doesn't actually stop developers from writing insecure code. You can point the finger after the fact, but if you want to actually improve security, we need better standards than this.

Re:Things to Use Instead of JSON Web Tokens by Freak_NL on Monday May 08, 2017 @07:33AM (#14290723)
> This is a bit like arguing against the claim that generating SQL queries by concatenating strings is unsafe. "Only if you completely bungle escaping the parameters", right?

No, you document how it should be done. Any major database layer using SQL provides parametrised SQL queries, and strongly suggests developers use that (usually in the quick start guide). You can still do your own concatenation, but aren't advised to.

The JWT libraries that are up-to-date and well-documented don't recommend blindly trusting the algorithm set in the header either, they recommend safe approaches such as configuring your whitelist and letting any unlisted algorithms fail. For example:

https://github.com/auth0/java-jwt#verify-a-token

Only if you completely refuse to read even the basic 'getting started' documentation will you get to this kind of weird vulnerability. The issues with this part of the JWT standard have been addressed by the libraries, what remains is just a little bit of effort on the part of the developer — which may be expected from someone writing security critical code.

That is, don't blame the hammer for the shoddy carpentry.

> So instead of relying on developers avoiding this pitfall each time, let's avoid the pitfall altogether and get rid of negotiation.

So write a concise pamphlet that can easily be shared with all of the JWT libraries in an issue/bug report. If there is a good argument for having to explicitly whitelist algorithms, they might welcome the suggestion.

Some libraries already do this mind!

Re:Things to Use Instead of JSON Web Tokens by gsylvie on Monday May 08, 2017 @02:23PM (#14294194)
Reminds me of the problem of fatal tractor rollovers on farms. Should we fix the problem with better documentation, better training, or better tractors?

http://www.sciencedirect.com/science/article/pii/S0925753596...

http://agrivita.ca/program/lowcost.php#LowCostRollOverProtec...

Re:Things to Use Instead of JSON Web Tokens by grovegames on Monday May 08, 2017 @03:41PM (#14294875)
I think all three should be used. But this isn't the question being addressed, which is whether to use tractors at all...
Re:Things to Use Instead of JSON Web Tokens by gsylvie on Monday May 08, 2017 @04:29PM (#14295298)
Even if better training or better documentation is available, how do you get the driver of the tractor to benefit from it?

The solution is better tractors. Don't blame the user.

Re:Things to Use Instead of JSON Web Tokens by dfsegoat on Monday May 08, 2017 @03:46PM (#14294912)
but why is that question being asked? because of safety / security...
Re:Things to Use Instead of JSON Web Tokens by kevinburke on Monday May 08, 2017 @11:47AM (#14292606)
I just documented how it should be done, in the article at the top of the page. The answer is "don't use JWT." Use specific tools for the thing you are actually trying to do, that have API's that are harder to mess up.
Re:Things to Use Instead of JSON Web Tokens by Minikloon on Monday May 08, 2017 @12:23PM (#14293028)
By that logic the answer is also "don't use SQL".
Re:Things to Use Instead of JSON Web Tokens by kevinburke on Monday May 08, 2017 @12:34PM (#14293132)
More like "Don't use SQL, if a thing adjacent to SQL exists that is better suited to a particular use case, doesn't have a history of poor implementations, and is harder for implementers and end users to screw up."

In this case:

- crypto_auth, or HMAC-SHA256 by itself, for authentication

- crypto_secretbox for symmetric encryption

- crypto_box or TLS for public key encryption

Re:Things to Use Instead of JSON Web Tokens by deathanatos on Monday May 08, 2017 @02:49PM (#14294405)
Good JWT libraries essentially have a "box" and "unbox" function; the work required by the client needed to go behind the library's back here is on the same level as that needed to behind crypto_box's. Further, crypto_box works on a lower level than JWT encode/decode functions typically do, and would leave many concerns that JWTs handle in the user's hands for them to handle, alone. Having the user write their own code to handle those concerns is a terrible idea.
Re:Things to Use Instead of JSON Web Tokens by mmalone on Monday May 08, 2017 @07:09PM (#14296447)
I'm with you on this. I've never thought of JWTs as a session storage mechanism; rather, I've always thought of them as a simpler (JSON-based) alternative to technologies like X.509 attribute certificates and SAML assertions. If you're creating a ticket / verifiable claim, there are a bunch of security considerations that JWT at least lays the groundwork for, and that NaCl secretbox doesn't appear to offer. Curious what OP thinks about putting things like payload canonicalization, subject/issuer/audience specification, and expiration entirely in the user's hands. I suppose its up to implementors to do appropriate validation, but at least JWT simplifies the conversation a bit.
Re:Things to Use Instead of JSON Web Tokens by wolco on Monday May 08, 2017 @01:00PM (#14293413)
But what happens is that sql version becomes sqlite and it doesn't provided enough power or flexibility.
Re:Things to Use Instead of JSON Web Tokens by rattray on Monday May 08, 2017 @01:33PM (#14293720)
> Use specific tools for the thing you are actually trying to do, that have API's that are harder to mess up.

That sounds like it would require a greater amount of knowledge to do correctly than "careful JWT".

Re:Things to Use Instead of JSON Web Tokens by kevinburke on Monday May 08, 2017 @02:20PM (#14294173)
"Careful JWT" implies you know what you should be careful about. If you know that much, you should just use the better things.

It also ignores the role JWT plays in promoting bad security practices

Re:Things to Use Instead of JSON Web Tokens by MR4D on Monday May 08, 2017 @06:10PM (#14296109)
Never underestimate the ignorance (or stupidity) of a developer under a deadline.
Re:Things to Use Instead of JSON Web Tokens by tracker1 on Tuesday May 09, 2017 @04:45PM (#14303650)
And that hasn't happened with similar authentication systems... I'd be surprised if there weren't a lot of broken OAuth/OpenAuth/OpenID systems with similar issues in the wild. Most of the issues I've seen with JWT I hadn't experienced because I hadn't thought to even allow such variety... in one case, the public key was cached from a fixed URL, and in others, shared key was forced in place.

It's only when you leave things open, or use a poorly implemented library that you have issues. It's a really easy standard to understand, and frankly most of the library implementations suck, but it's really easy to roll your own, and lock it down to the single implementation details you use internally.