The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (2024)


The criticisms of JWT seem to fall into two categories:

(1) Criticizing vulnerabilities in particular JWT libraries, as in this article.

(2) Generally criticizing the practice of using any "stateless" client tokens. Because there's no great way to revoke them early while remaining stateless, etc.

The problem is that both of these groups only criticize, neither of them can ever seem to actually recommend any alternatives.

I could care less about JWT per se. I'm happy to implement a similar pattern with something else (e.g. store a secure cookie post-auth, skip all the refresh business and just let it expire when it expires, and employ an ugly revocation strategy only if absolutely necessary). I don't need JWT for this.

If I'm providing a REST API, then I'd prefer a token string that I could pass as a header value rather than forcing the use of cookies. Although I suppose you could argue that a cookie is just another header value.

Either way, if you're serving up a REST API to a JavaScript UI... what's NOT a good option is server-side session state (e.g. Java servlet sessions). That requires you to either: configure your load balancer for sticky-sessions, or employ a solution to share session state across all your server-side instances (which never works very reliably). Moreover, relying on a session isn't a very RESTful auth strategy in the first place.

So if I'm writing a SPA in 2017, then I'm definitely taking a client-side approach and running afoul of the #2 critics. And since JWT is so widely implemented (e.g. if I use a "Login with Google" option then I'm using JWT), I'm probably running afoul of the #1 critics too.

These criticism are fine, I guess. There's no faster route to blog clicks, book sales, speaker invites, and consulting dollars than: (1) telling everyone to jump on this year's hype train, or (2) telling everyone that last year's hype train sucks. What the world really needs is a bit more actual prescriptive recommendations of what to do instead.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (1)

tptacek on March 14, 2017 | next [–]


I don't care if you want to use stateless client tokens. They're fine. You should understand the operational limitations (they may keep you up late on a Friday scrambling to deploy a token blacklist), but, we're all adults here, and you can make your own decisions about that.

The issue with JWT in particular is that it doesn't bring anything to the table, but comes with a whole lot of terrifying complexity. Worse, you as a developer won't see that complexity: JWT looks like a simple token with a magic cryptographically-protected bag-of-attributes interface. The problems are all behind the scenes.

For most applications, the technical problems JWT solves are not especially complicated. Parseable bearer tokens are something Rails has been able to generate for close to a decade using ActiveSupport::MessageEncryptor. AS::ME is substantially safer than JWT, but people are swapping it out of applications in favor of JWT.

Someone needs to write the blog post about how to provide bag-of-attributes secure bearer tokens in all the major programming environments. Someone else needs to get to work standardizing one of those formats as an alternative to JWT so that there's a simple answer to "if not JWT then what?" that rebuts the (I think sort of silly) presumption that whatever an app uses needs to be RFC standardized.

But there's a reason crypto people hate the JWT/JOSE/JWE standards. You should avoid them. They're in the news again because someone noticed that one of the public key constructions (ECDHE-ES) is terribly insecure. I think it's literally the case that no cryptographer bothered to point this out before because they all assumed people knew JWT was a tire fire.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (2)

Alex3917 on March 14, 2017 | parent | next [–]


> they may keep you up late on a Friday scrambling to deploy a token blacklist

Because every token has an iat datetime, you don't need a token blacklist to invalidate tokens. You just need some sort of tokens_invalid_if_issued_before_datetime setting that gets checked whenever you validate the signature of a token.

The alternative is to store a UUID for each user, and just rotate those whenever they log out, change or reset their password, or there is some sort of security event. These are then stored in the payload and used as a secret. The one advantage over just using dates is that with the former, there can be weird bugs if you have multiple servers with clocks that are out of sync.

But you shouldn't ever need to blacklist specific tokens, at least not unless you have some highly specialized use case.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (3)

unscaled on March 14, 2017 | root | parent | next [–]


Agreed. Revoking all user sessions instead of a specific token is the common case. The only usage I see for revoking a specific token is when the user is deactivating a specific client.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (4)

nb777 on March 15, 2017 | root | parent | next [–]


Also when a user changes his password, no ?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (5)

couchand on March 14, 2017 | root | parent | prev | next [–]


> The alternative is to store a UUID for each user

Is that not effectively a server-side session?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (6)

Alex3917 on March 14, 2017 | root | parent | next [–]


> Is that not effectively a server-side session?

With most web frameworks (e.g. Django), the user model is retrieved on every request anyway. So it would be perhaps more accurate to say that it's a server-side session that's effectively not a server-side session, since no additional lookups are needed, only the user model lookup that's already done anyway.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (7)

theptip on March 14, 2017 | root | parent | prev | next [–]


So every user on your system has to reauthenticate if one client token is compromised? That seems like an invitation to a thundering herd. Not necessarily fatal, but I'd consider it a nice feature to not have to invalidate everybody's tokens to get at one.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (8)

Alex3917 on March 14, 2017 | root | parent | next [–]


> So every user on your system has to reauthenticate if one client token is compromised?

No, because you would also store either a separate datetime or uuid on each user model. And if just one user has their credentials compromised, then you would bump the date or generate a new UUID for just that user.

The global datetime would only be bumped if some site wide vulnerability were found.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (9)

igl on March 14, 2017 | root | parent | next [–]


So there is a db roundtrip involved? Like a inverted session. Whats the point of using jwt then?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (10)

Alex3917 on March 14, 2017 | root | parent | next [–]


For most web frameworks, the user model gets retrieved from the db automatically whenever an authenticated request is made. So there is no extra lookup.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (11)

igl on March 15, 2017 | root | parent | next [–]


Oh man.

Proponents say critics dont offer alternatives at the same time they always literally 'reverse' engineered sessions if you dig deep enough.

I give up. JWT is just a hip thing to do right now. :(

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (12)

theptip on March 14, 2017 | root | parent | prev | next [–]


Got it, didn't catch that you were referring to storing that timestamp per-user.

That's what I do in my system.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (13)

bgentry on March 14, 2017 | parent | prev | next [–]


Assuming that:

- your JWT libraries don't do anything dumb like accepting the `none` algorithm

- you're using HMAC SHA-256

- your access tokens have a short (~20 min) expiration time

- your refresh tokens are easily revocable

Can you elaborate on the specific security advantages that a token encoded with ActiveSupport::MessageEncryptor would have over such a JWT implementation?

Why do you think there aren't more AS::ME implementations out there if it's a superior solution? I only know of a Go implementation and haven't seen others: https://godoc.org/github.com/mattetti/goRailsYourself/crypto

Edit

I saw you mention Fernet in another comment. As a Heroku alum I'm quite familiar with Fernet (we used it for lots of things), but to my knowledge those projects are on life support at best.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (14)

unscaled on March 14, 2017 | root | parent | next [–]


You should also make sure to allow only tokens with the "HS256" alg headers before you verify them, in case somebody decides to add a new signature algorithm to your library, and it turns out it could easily be broken and lets you use the same key you used for HS256.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (15)

tracker1 on March 14, 2017 | root | parent | next [–]


If it's your software generating the tokens, then that means they'd need the shared key, or private key in order to sign the token... which is already a problem. Now if you're accepting tokens from a third party, that's another issue, and should be much more constrained.

I go farther still and require a VERY short expiration on service to service requests (documented as 1m, coded as 2m) which combined with https limits the chance of replay attacks.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (16)

bgentry on March 14, 2017 | root | parent | prev | next [–]


yes, that's another good point and probably something many folks mess up. I am explicitly specifying my algorithm for both encode/decode :)

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (17)

cainlevy on March 14, 2017 | root | parent | prev | next [–]


> using HMAC SHA-256

HMAC is great for monolithic architecture, but I've quite enjoyed using asymmetric RS256. I don't think that's something AS::ME offers.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (18)

Zombieball on March 14, 2017 | root | parent | prev | next [–]


I'd also be interested in hearing an answer to this from tptacek.

My (limited) understanding is the security issues arise around the implementation & handling some of the default claims (NBF, IAT, etc.) and producing/verifying the signature.

But I don't quite understand how moving to a different format solves these issues?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (19)

theptip on March 14, 2017 | parent | prev | next [–]


I appreciate that this comment is wise from a cryptosystems perspective, i.e. there are a number of ways to do JWT wrong, not enough safety guards, etc., but is there not a subset of JWT that is safe to use?

The OP article makes it sound like it's impossible to use JWT correctly, but I was under the impression that if I 1) am the issuer, and 2) I hardcode a single algorithm on my API endpoints, that neither of the issues in the OP apply. (The EC issue would apply if that algorithm was chosen).

Is there a safe subset of JWT? And isn't there value to small players in using the safe subset of JWT which is battle-hardened by guys with big security teams like Google?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (20)

fovc on March 14, 2017 | parent | prev | next [–]


It's not that need an RFC standardized solution for everything, but I'd rather not roll my own anything related to crypto. Would something like crypto_auth(json(bag)) be better here?(crypto_auth from libsodium, json being sorted without whitespace)

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (21)

tptacek on March 14, 2017 | root | parent | next [–]


Yes, that would be much better, and it's what I mean when I say that JWT doesn't bring anything to the table.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (22)

arethuza on March 14, 2017 | root | parent | prev | next [–]


"json being sorted without whitespace"

What is the significance of that part?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (23)

zeveb on March 14, 2017 | root | parent | next [–]


It makes JSON deterministic, which it isn't by default (e.g. {"foo": 1, "bar": 2} and {"bar":2,"foo":1} are both valid serialisations.

Of course, it'd be better still to use a format _meant_ to provide human-readable canonical representations of data, e.g. Ron Rivest's canonical S-expressions (http://people.csail.mit.edu/rivest/Sexp.txt), but of course this is information technology and we have to reinvent the wheel — usually as an irregular polygon — every 3-4 years rather than using techniques which are tried and true.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (24)

arethuza on March 14, 2017 | root | parent | next [–]


Ah yes, similar to canonicalization of XML for XMLSignature?

Presumably this means that you have to have have a "flat" JSON structure rather than lots of nested objects and arrays?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (25)

woah on March 14, 2017 | root | parent | next [–]


Afaik you just need to alphabetize the properties of every object

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (26)

scottmf on March 14, 2017 | parent | prev | next [–]


> there's a reason crypto people hate the JWT/JOSE/JWE standards. You should avoid them

Could you give more info about this? If ECDHE-ES is avoided why else is JWT insecure?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (27)

tptacek on March 14, 2017 | root | parent | next [–]


The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (28)

mst on March 14, 2017 | parent | prev | next [–]


Seems like, practically, that suggests three options:

1. Take something like AS::ME that already has real use and implement it for as many platforms as possible

2. Define a really restricted subset of JWT (which may be necessary anyway for purposes of saying to management "yes, we're buzzword compliant")

3. Invent a non-AS::ME "bag-of-attributes secure bearer token" system and implement it everywhere.

I think part of the trouble with 3 is that people like me genuinely worry that if we tried to roll our own we'd manage to do worse than JWT in spite of JWT being terrible.

So maybe step zero is for somebody with crypto knowledge to explain one sane way to do the "bag-of-attributes secure bearer token" part ... or you to point the audience to a blog post that already exists that describes it, because, well, because I suspect quite a few of us trust you to say "this post actually describes a sensible plan" while we don't trust ourselves to be able to tell.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (29)

cainlevy on March 14, 2017 | root | parent | next [–]


1. The reason AS::ME can be that nice is because it assumes a monolithic architecture and a single framework.

For example, AS::ME relies on shared secrets, which I think makes it unfit for distributed systems. Implementing JWK with asymmetric keys can really reduce provisioning and configuration costs. Keeping the signing secret on one private, hardened auth server (or cluster) also allows smart things like automated key rotation.

2. 100%. There's at least one right way to do JWT, but more ways to do JWT wrong.

3. JWT et al provide a fine starting point, I don't see a reason to start from scratch.

I'm not tied to the JWT spec, but I'm quite happy with what I've been able to accomplish using a careful implementation in my AuthN server: https://github.com/keratin/authn

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (30)

tracker1 on March 14, 2017 | root | parent | next [–]


Agreed... my first two experiences with JWT were creating my own implementation... in my case, the allowed public keys had to come via https from a specific server in the domain, even without PKI using shared key... I had hard coded the algorithm used for the signature. This could just as easily be filters on a library though, it's just my first experience didn't have a valid library, so I had to composite one (did use existing crypto library though).

JWT is a perfectly valid structure, even if the spec is more flexible than it should be. By that matter, https also has historically supported algorithms and protocols later broken. Nobody is suggesting we stop use HTTPS, only that we limit acceptable protocol and algorithms supported.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (31)

tptacek on March 14, 2017 | root | parent | next [–]


No, almost everybody in the field laments SSL and TLS. It's probably too late at this point --- and has been for well over a decade --- to get to something better than TLS, and so TLS 1.3 is what we're stuck with. But that is demonstrably not the case with JWT. We don't have to convince all the browser vendor to upgrade out of JWT in lockstep. Avoiding another 20 years of hair-on-fire crypto vulnerabilities seems reason enough to lobby against that spec.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (32)

tracker1 on March 14, 2017 | root | parent | next [–]


But any given algorithm today may not be sufficient tomorrow... so we just don't use ANY encryption? JWT is a perfectly valid structure.. there are options as to signing, so use/limit as needed.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (33)

yuhong on March 15, 2017 | root | parent | prev | next [–]


And I think JWT is more flawed than SSL/TLS.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (34)

tptacek on March 14, 2017 | root | parent | prev | next [–]


Or just use Fernet:

https://github.com/fernet/spec/blob/master/Spec.md

Fernet was written originally for Python but there's a Ruby implementation, a Golang implementation, and a Clojure implementation. I believe that for at least 80% of applications considering JWT, Fernet provides exactly the right amount of functionality, and does so far more safely than JWT.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (35)

Flenser on March 15, 2017 | root | parent | next [–]


Since it's not linked from any https://github.com/fernet/ project as far as I could tell, and I had to google for it.

Clojure implementation:

https://github.com/derwolfe/fernet-clj

I also found a JavaScript implementation:

https://github.com/csquared/fernet.js

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (36)

mst on March 14, 2017 | root | parent | prev | next [–]


This looks very much like the approach to session-data-in-encrypted-and-signed-cookie I've seen used to great success in lots of places (where for a stateless-ish API the contents are just a user id or whatever).

Am I right that this would work fine both in that or in e.g. a query parameter?

(sorry if I'm asking really stupid questions, but I'd rather look stupid than accidentally a security hole)

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (37)

tracker1 on March 14, 2017 | parent | prev | next [–]


For my service to service requests, I tend to require the token itself be set to an expiration of less than 1 minute from creation. I actually code 2min in the check, but document 1 for access clients. This allows for more than enough drift and with https mitigates the level of risk for replay attacks.

Beyond this a header/signature for the body/payload will reduce the risk of the rest.

As to being able to select the signature algorithm, or set the uri for the public key... ignore this, or whitelist domains or methods. Yes, there's some wholes regarding a "by the books" implementation... that doesn't mean you need to support the entire spec.

I implemented about 1/2 the SCORM spec in an API once, and it was 8 years before a specific course needed a part that was missing. Yes, it isn't 100% compliant, but if it does the job, and is more secure as a result, then I'm in favor of it.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (38)

asanso on March 14, 2017 | parent | prev | next [–]


It seems that Matthew Green warned them about some of their choices though back in 2012!! https://www.ietf.org/mail-archive/web/jose/current/msg00366....

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (39)

danjoc on March 14, 2017 | parent | prev | next [–]


>that rebuts the (I think sort of silly) presumption that whatever an app uses needs to be RFC standardized.

I thought crypto mantra was "Never roll your own." An RFC (Request For Comments) is a literal attempt to follow that advice by seeking the advice of cryptographers who are presumably smarter at coming up with crypto standards. Where were the cryptographers during the draft phase when comments were being solicited?

>I think it's literally the case that no cryptographer bothered to point this out before because they all assumed people knew JWT was a tire fire.

Oh. Cunningham's Law. You know, if you're not part of the solution, you're part of the precipitate.

That's some considerable JWT fallout, since companies making a business out of security are endorsing it. Auth0 for example, https://auth0.com/docs/jwt

Until I read this article, I was under the impression JWT was the best new thing.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (40)

tptacek on March 14, 2017 | root | parent | next [–]


I don't care about these moral arguments. I'm making a simple, positive claim: JWT is bad. You can blame whoever you'd like for it being bad, but as engineers, you need to understand first and foremost that JWT is bad, and reckon with your feelings about that later.

You have a responsibility to built trustworthy systems, and you get no pass on building with flawed components simply because you wish experts had made those components less flawed.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (41)

contrast on March 15, 2017 | root | parent | next [–]


"Contribute to standards processes" and "don't roll your own" aren't moral arguments. They're complimentary pieces of practical advice on how to make trustworthy systems.

Meanwhile your comments bury whatever substantive content they might hold under layers of emotional, accusatory garbage. Maybe get those feelings locked down a bit before posting?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (42)

Alex3917 on March 14, 2017 | root | parent | prev | next [–]


Do you have any recommendations for SPAs where the API is hosted on a different subdomain than www? I think everyone agrees that JWT is a bad spec, the problem is that setting cookies across subdomains ranges from difficult to impossible.

If you have access to an experienced devops team who can securely maintain an nginx server with some proxy logic then maybe that's a possibility, but otherwise what other viable options are there? Wishing that JWT were more secure won't make it so, but neither will wishing that CORS were more flexible. And if it's a choice between subclassing the JWT handlers to provide a couple extra security checks vs trying to securely configure and maintain a whole extra proxy setup, then the former seems like the lesser of the evils.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (43)

caivvoacmh on March 15, 2017 | root | parent | prev | next [–]


Does this mean that using AWS Cognito [1] is out of the question since it uses JWT? Unfortunately, you can't change what the service uses as it's all under Amazon's control.

[1]: https://docs.aws.amazon.com/cognito/latest/developerguide/am...

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (44)

danjoc on March 14, 2017 | root | parent | prev | next [–]


I have no feelings on the subject. I don't use JWT. I just want to point out this sounds like (and continues to sound like) "Roll your own" advice to me.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (45)

lr4444lr on March 14, 2017 | prev | next [–]


Either way, if you're serving up a REST API to a JavaScript UI... what's NOT a good option is server-side session state (e.g. Java servlet sessions)

Can you explain what you mean, as oppose to other kinds of session tokens?

Roy Fielding makes it abundantly clear[0] in the seminal delineation of REST that

 We next add a constraint to the client-server interaction: communication must be stateless in nature, as in the client-stateless-server (CSS) style of Section 3.4.3 (Figure 5-3), such that each request from client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server. Session state is therefore kept entirely on the client.

This has given me pause to doubt just how many people are really implementing REST, and/or how useful a model it is in modern web applications.

[0]https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arc...

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (46)

throwaway2016a on March 14, 2017 | parent | next [–]


> This has given me pause to doubt just how many people are really implementing REST, and/or how useful a model it is in modern web applications.

Not many. I've made a good career out of consulting people who are doing REST wrong :)

Usually they are either storing state or forgetting about HTAEOAS (Hypermedia). Often they are also negotiated format and version incorrectly and in a way that doesn't scale.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (47)

woah on March 14, 2017 | root | parent | next [–]


I'm going to contend that a "correct" implementation of REST has never existed

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (48)

meric on March 14, 2017 | parent | prev | next [–]


IMO sessions for authentication is fine as long as we don't store any session variables. In the end someone's going to be keeping track of the number of GET requests made by each API consumer on each endpoint, and practically it's not breaking REST as long as that state doesn't affect the information GETable by the client.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (49)

lr4444lr on March 14, 2017 | root | parent | next [–]


I just can't reconcile the fact that if I hit an endpoint, and I get back certain data with a 2XX response code because I previously accessed a "login" resource, but I would have gotten a 4XX response code if I had not gone to that prior "login" resource that I haven't violated REST: my request for the second endpoint takes advantage of stored context on the server. Even worse, if I restart the server, change out its database, or make some other stateful change on it, the response changes. And I don't mean to imply that this is a universal sin of computing architecture, but it sure as hell looks like a violation of REST, and it begs the question of what our standard is. Headers, path-based nomenclature, network layering, authentication - I'm on board with all of that. I just worry that a lot of people might be falling victim to commonplace misconceptions of just what REST is, which in turn may be causing us (the web dev community) to make misplaced value judgments.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (50)

jayd16 on March 14, 2017 | root | parent | next [–]


Rest doesn't mean no state in the world exists. It's not a violation at all that an endpoint changes its output. Rest only reasons about idempotency, not reproducibility.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (51)

jdmichal on March 14, 2017 | root | parent | next [–]


> Rest only reasons about idempotency, not reproducibility.

Absolutely. If you GET a collection resource, then POST a new item into the collection, then GET the collection again, the response will have changed. Having these kind of temporal dependencies on the answer you receive is not something REST argues against.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (52)

dragonwriter on March 14, 2017 | root | parent | prev | next [–]


None of that violates REST; REST is not statelessness. In fact, REST (REpresentational State Transfer) is all about state and how it is changed and how those changes are manifested.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (53)

Chris2048 on March 14, 2017 | parent | prev | next [–]


So, does this include web tokens too, or is auth a special case?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (54)

jv22222 on March 14, 2017 | prev | next [–]


On another note.

Dear Americans, the queen would like you to stop saying "could care less" - by David Mitchell of Peep Show

https://www.youtube.com/watch?v=om7O0MFkmpw

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (55)

eric_the_read on March 14, 2017 | parent | next [–]


I could care less about this request, but I can't be bothered to make the effort.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (56)

nocman on March 14, 2017 | parent | prev | next [–]


I am American, and I'm sure this bothers me more than it actually bothers the queen.

Between that and the incessant use of the incorrect phrase "for free" instead of the correct phrase "for nothing" it's amazing that I can stand to read anything on the internet.

xD

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (57)

striking on March 14, 2017 | root | parent | next [–]


You should write a browser extension that fixes that. I'd use it.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (58)

nocman on March 14, 2017 | root | parent | next [–]


Ooh, I like that idea. Don't tempt me!

xD

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (59)

jchw on March 14, 2017 | prev | next [–]


What's difficult about setting up a Redis cluster to back sessions? Yes, it adds a point of failure... so does having a database of any kind. However, I'd hardly call it difficult. If you're on Amazon, you can just create an Elasticache cluster and not even concern yourself with the ops.

I don't hate secure cookies or anything, but some people act like plain-old regular cookies haven't been thoroughly solved by this point.

Related: Something people get wrong a lot with secure cookies is worrying about obscuring the cookie more than securing it. Encryption does not give you authentication; you need MAC for that. An encrypted message can still be blindly modified. Imagine being able to change a UID stored in a "secure" cookie even if you couldn't 100% control which. Eventually, if you try enough permutations, you're going to escalate your privileges!

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (60)

jdmichal on March 14, 2017 | parent | next [–]


Nothing's difficult about that. But that doesn't mean that it's a good idea. How about distributing a signature and encryption key to all your servers, and using them to secure the outgoing and verify the incoming tokens. If you want easy, that's probably even easier than setting up a Redis store and tying your services to it.

Need an emergency revoke of every token? Easy: Replace your signature key. Any older token will fail signature verification. In which case, your system should require authentication and then generate a new token with an updated signature.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (61)

batoure on March 14, 2017 | parent | prev | next [–]


Here is the use case that lead to the first implementation of JWT I was ever part of.

You have a single page webapp that uses two APIs for part of the application. For security reasons the APIs are zoned in such a way that neither of them can communicate with each other. The machine of the user sits in a zone where it can send HTTP requests to the zones of either API.

Now design a way to manage sessions across both APIs...

There are certainly a number of ways to accomplish this, but JWT was the cleanest and most performant.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (62)

chmike on March 14, 2017 | parent | prev | next [–]


When the authentication info needs to be used with servers in different location of the world, JWT is better. Getting the session info from a redis server or something equivalent isn't free. Deciphering a JWT token may be faster. So, the most appropriate method depends on the use case.

If all the servers are in one location, a random byte sequence as session id key with cached info is the most simple, compact and efficient.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (63)

jjawssd on March 14, 2017 | root | parent | next [–]


Or you can use read only Redis replication and keep your architecture pretty much the same https://redis.io/topics/replication

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (64)

daenney on March 14, 2017 | root | parent | next [–]


What happens when that replication breaks? Can people still log in? Can you still validate their sessions? Or are you going to have an outage in a geographical region?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (65)

jjawssd on March 14, 2017 | root | parent | next [–]


Fall back to connecting to the main instance directly

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (66)

tracker1 on March 14, 2017 | root | parent | next [–]


And if the replication is down because the main instance can't be reached for a minute?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (67)

jjawssd on March 14, 2017 | root | parent | next [–]


And if your user base is hit by a nuclear bomb?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (68)

stephenr on March 15, 2017 | parent | prev | next [–]


The problem is you're suggesting real-world, ops-capable solutions to a problem "Devops" (as in, developers can do it, we don't need ops) people don't want to understand because they'd rather jump on yet another poorly designed "solution" to a problem they don't really have.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (69)

tracker1 on March 14, 2017 | parent | prev | next [–]


JWT signature verification usually takes less time than the network request to a redis server... assuming it's non-local, because HA.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (70)

jchw on March 15, 2017 | root | parent | next [–]


I'll just say this: if the most expensive part of your API is calling Redis, it probably doesn't have anything worth authenticating for in the first place.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (71)

jdmichal on March 14, 2017 | prev | next [–]


I can make an attempt at an alternative:

Distribute signing and encryption keys to all servers. Have them encrypt and sign the outgoing serialized token, whatever that consists of. Have them verify and decrypt the incoming token. This is just straight-forward cryptography, with keys known only to the server, so I'm pretty sure you won't get any arguments from (1). (And, I suppose the encryption could even be skipped, if you don't care that the internal format of the token is known.)

Emergency revocation of all tokens [0] is simply rotating the signing key. All tokens issued prior to the rotation will fail verification with the new key. That should trigger the authentication process, which will issue a new token with the updated key. This solves the revocation issue present in argument (2).

[0] Any other form of revocation is, in my opinion, not distinguishable from having server-side state. If you have to keep a list of bad tokens, why not just keep a list of the good tokens instead... And then it's only a short hop to the token being nothing but a key to lookup the full session state on the server.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (72)

deepanchor on March 14, 2017 | parent | next [–]


This is exactly the solution I use. I use a secret server (Vault, using Consul as a backend) to securely distribute and manage the encryption keys.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (73)

tracker1 on March 14, 2017 | parent | prev | next [–]


And if you want to be able to authenticate users to a service that you do not want to send private keys to?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (74)

jdmichal on March 14, 2017 | root | parent | next [–]


Then sign / encrypt the token with a private key and distribute a public key to the untrusted peers. Since you're just using bog-standard cryptography primitives you can change them at will to match your use case. Need to handle untrusted peers? Asymmetric keys are the answer.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (75)

tracker1 on March 14, 2017 | root | parent | next [–]


Or, you use the asymmetric key/pair to sign the JWT, and lock your environment to only public keys signed by your DC's cert in your org. If only that was supported by JWT.. oh, that's right, it is.

Nobody has to implement the FULL spec, you only need to allow what your environment needs.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (76)

jdmichal on March 15, 2017 | root | parent | next [–]


I'm not really sure what your point is, other than an apparently fervent desire to prove JWT's worth while speaking down to me. I didn't say that JWT couldn't do that... You're the one who set up the strawman of untrusted parties, then gleefully knock it down after I address the issue. You have contributed no other valid feedback to my proposal, just a defense of JWT which is not an answer to anything I ever stated.

I just want you to know that such tactics are not very appreciated from this side of the conversation.

What does JWT provide that using bog-standard crypto primitives in the way I described doesn't? Other than a name and a standard?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (77)

batoure on March 14, 2017 | parent | prev | next [–]


You do understand that this is fundamentally the exact underlying mechanic of JWT?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (78)

jdmichal on March 14, 2017 | root | parent | next [–]


You call it the underlying mechanic. I call it the only necessary mechanic. If those additional mechanics are where the security issues come from, then just get rid of them.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (79)

tracker1 on March 14, 2017 | root | parent | next [–]


No one is forcing you to accept/implement ALL possible aspects of JWT.. in fact, that's generally a bad idea... Only need to implement what you need. If a specific algorithm is bad, don't allow it...

Isn't this how HTTPS works, HTTPS today doesn't use the same SSL and algorithms allowed in 1996, it's evolved and changed in practice. The author isn't suggesting everyone just not use HTTPS because some possible algorithm has been determined to be weak is he?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (80)

jdmichal on March 15, 2017 | root | parent | next [–]


> No one is forcing you to accept/implement ALL possible aspects of JWT.. in fact, that's generally a bad idea...

I think this is a very interesting, because it's basically validating the article's argument. People are going to feel safe implementing JWT because it's an RFC, without knowing where these "generally bad idea" landmines are. That's the dangerous part.

And yes, the same issues exist in SSL / TLS. And guess what? There's loads of articles just like this one stating how dangerous older modes of these protocols are. Articles like this and the discussions they spawn are exactly the kind of thing necessary to move the world forward into safer implementations.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (81)

mgkimsal on March 14, 2017 | prev | next [–]


> If I'm providing a REST API, then I'd prefer a token string that I could pass as a header value rather than forcing the use of cookies

Aren't cookies just strings passed as HTTP headers?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (82)

meric on March 14, 2017 | parent | next [–]


I hope someone can explain to me in practical terms difference between a session cookie string on a request and a token as header value.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (83)

Illniyar on March 14, 2017 | root | parent | next [–]


Cookies are just string in a header. The difference is that unlike normal headers browesers treat cookie headers in a special way. They automatically add and remove keys from it, and they allow the server to set the header in a way that the client can neither see it nor change it (http only headers)

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (84)

deathanatos on March 14, 2017 | root | parent | next [–]


The downside being that the browser will attach it to every request; if you use cookies, you MUST be aware of this, or you are (IMO) pretty much guaranteed to write a CSRF vuln.

(I'm much more in the localStorage + Authorization header for this reason. I recommend [1] for reading. If malicious JS is running, cookies won't save you, since the malicious JS is capable of simply making the request itself, to which the cookie will automatically be attached by the browser. localStorage+JS eliminates CSRF. If someone XSS's you, the difference is irrelevant.)

[1]: http://blog.portswigger.net/2016/05/web-storage-lesser-evil-...

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (85)

joepie91_ on March 14, 2017 | root | parent | next [–]


> I'm much more in the localStorage + Authorization header for this reason.

That's just exchanging one security issue for another. Now you have the ability for people to steal tokens after an XSS attack. And yes, that's significantly different from "can make requests on your behalf".

The correct solution is to solve the CSRF vulnerabilities by using CSRF tokens. Not to change your auth persistence mechanism.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (86)

mwpmaybe on March 14, 2017 | root | parent | prev | next [–]


CSRF protection:

* Use SameSite cookies (unfortunately, not yet supported by all browsers)

* Don't accept application/x-www-form-urlencoded, multipart/form-data, or text/plain at your endpoints, or

* Use CSRF tokens if you need to accept server-side rendered HTML forms

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (87)

Illniyar on March 14, 2017 | root | parent | prev | next [–]


CSRF is the easiest vulnerability to avoid, a csrf token solves all csrf attacks.

XSS is a lot harder to protect against, one of the better ways to mitigate it's effects is to use http only cookies

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (88)

deathanatos on March 14, 2017 | root | parent | next [–]


Well, I keep running into CSRF vulns. in the wild, so…

XSS is avoidable by systematically having a framework that escapes any inputs that are run through it. (jinja2, on the server, can do this, though it defaults to not, which I wish wasn't true.) I'm not saying that XSS is much better that CSRF, really; I've seen these, too.

the point (and that of the linked article) is more that either you're not subject to XSS, in which case localStorage is strictly better than cookies (it is default-secure), or you're subject to XSS, in which case neither saves you.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (89)

Illniyar on March 15, 2017 | root | parent | next [–]


The idea that Session Hijacking attacks are irrelevant when a user can use XSS to perform any action on the client is interesting.

Definitely if your service is a valuable target that hackers will spend the time to reverse engineer your client code to create custom tailored XSS attacks then protecting against Session Hijacking does seem to be pointless.

But session hijacking is considered to be a very common attack (though I can't find any real numbers anywhere, maybe it's not?), most services with low attack value will probably be better served by httpOnly cookies and csrf tokens that make worthwhile XSS attacks more time consuming then preventing XSS altogether, which is an enormous, continuous effort.

Also your implying that CSRF is hard to defend against (otherwise why do you keep running into it) but in the same breath saying that XSS is simple to defend against.

If people can't defend against CSRF (which is usually just a simple flag for most frameworks), they aren't prepared to defend against XSS which means getting into a security mindset in all things. A serverside template is not enough - XSS can manifest in headers, in clientside code, in third party code, in redirections and it is easy for a developer to mistakingly add a new attack surface.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (90)

zeveb on March 14, 2017 | root | parent | prev | next [–]


One small correction: the client (i.e., the web browser or other web client) can see HTTP-only cookies just fine; code running in a conforming browser cannot.

But if I write some code using DRAKMA, urllib or net/http, and can see those cookies just fine.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (91)

Ajedi32 on March 14, 2017 | parent | prev | next [–]


The very next sentence:

> Although I suppose you could argue that a cookie is just another header value.

So... yes.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (92)

mgkimsal on March 14, 2017 | root | parent | next [–]


Ack - missed that - was visually jumping around some.

But yes, it is.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (93)

batoure on March 14, 2017 | prev | next [–]


I grow more and more tired of posts touting engineering sensationalism.

Here is a point of order for developers who work on something realize it isn't idiot proof (them proof) out of the box and then want to write a sensational post:

Implementation and design are a core part of anything you do and considering the risks and accounting for them are part of doing business.

Having worked with large organizations that do active and passive scanning of the web I am constantly shocked how often we are contacting someone about basic SQL injection in their application... in 2017.

JWT is an incredibly powerful standard if implemented effectively but its not for the LAZY, it requires thoughtfulness where ever it is active.

JWT solves a serious and real problem that organizations face at scale which is why you see it implemented in systems like google sign in. Realistically its not going anywhere.

People love criticizing the movement towards stateless tokens on the web I find it pretty funny... crawl down the stack from their webheads and you usually come face to face with Kerberos managing auth within their networks...

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (94)

tboyd47 on March 14, 2017 | prev | next [–]


The article very clearly is about the standard, not a particular JWT library.

Server-side session tokens stored in the database worked fine ten years ago, and they work fine today. No need to muck with the load balancer.

Stateless tokens are great too, and use two-factor auth when you need that extra layer of security. No need for newfangled standards; HTTP Basic remains a simple and effective way to convey that token.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (95)

tracker1 on March 14, 2017 | parent | next [–]


Except there are now many instances where no single database server can keep up with request load. It's not fine in all cases today. Where I work now a single request from the user goes into a pipeline of requests (some can be parallel, others not)... our SLA is X, everything that adds up to the total request time counts. Adding even 2-3ms for each service layer to verify session keys is too much.

This is as opposed to < 0.1ms for verifying a JWT. JWT is a structure for stateless tokens... once you have a token, what does 2FA add? nothing. Also, some algorithms are insecure, so don't use them, or blacklist them... Or, better whitelist the algorithm you do use.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (96)

tboyd47 on March 14, 2017 | root | parent | next [–]


I've got nothing against stateless tokens. What I'm saying is that it can be a much easier and more effective pattern to add a second layer of security than to add complexity to the first layer (the token). I believe this is like the idea of defense in depth. For example, making signed-in users re-enter their password before performing certain actions may be preferable to introducing cryptography into all sign-in actions.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (97)

tracker1 on March 14, 2017 | root | parent | next [–]


This isn't just for all sign-in actions.. it's for all API requests, and in some designs passthrough requests on behalf of a user to another server/service. It isn't just used for UI requests. It can also be used from Server to Server/Service requests... across data centers. You can do signed tokens/authentications without introducing many potential points of failure.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (98)

tofflos on March 14, 2017 | root | parent | prev | next [–]


If you're on Java and using an ORM like Hibernate, then that user will be found in the second-level cache. This will eliminate the need for a database roundtrip for all requests after the first authentication. From that point on that particular user will be retrieved from memory.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (99)

tracker1 on March 14, 2017 | root | parent | next [–]


Which will require session pinning for the load balancer, not to mention, I'm not using Java or a similar ORM. That will only help for a single instance of an application on a single server... not much help when you specifically don't want session pinning.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (100)

tofflos on March 14, 2017 | root | parent | next [–]


I agree that not everyone is on Java and using an ORM. But is it only useful for a single server? If you have multiple servers then you would also have a distributed second level cache which would eliminate the need for session pinning.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (101)

tracker1 on March 14, 2017 | root | parent | next [–]


distributed, or duplicated... each server potentially making that DB request... depending on load adding at least 2-3ms, potentially more. If a given request to a single endpoint needs to touch a dozen more, not including resource lookups and when not everything is parallel... or across datacenters, from the colocated to aws, etc.. it all adds up.

Very short lived JWT mitigates this as the window for replay is reduced, over HTTPS by the time you can crack it, that window is effectively gone. The server can verify a signature on a JWT in a fraction of a second... far faster than a DB call... Not including replication issues.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (102)

gregpardo on March 14, 2017 | prev | next [–]


For number 2, you could expire them by encoding some identifier based off a hash or key tied to the user object. Change that object and have the server reject the token if that meta data no longer validates.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (103)

tracker1 on March 14, 2017 | parent | next [–]


Or have really short lived tokens, requiring regular refresh, and don't worry about expiring them... you can then delete the refresh token so it can't be found requiring full re-auth if necessary.

OAuth2 + JWT is fine... just whitelist the algorithms you allow and use HTTPS for all communications, even internal.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (104)

voidfunc on March 14, 2017 | prev | next [–]


I feel like the argument against #2 is usually purely hypothetical in nature. I really do not have a problem maintaining a small lookup cache for revocations. I feel like the argument against doing this tries to take the form of all server-side kept state is bad when in reality it's sticky state and huge object graphs (read: memory consumption) that get stuffed into session objects that are the real evil.

A server with 1GB can hold a lot of JWT's in memory. Probably more than most of the people building services here have to actually deal with.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (105)

falcolas on March 14, 2017 | parent | next [–]


Sure, revocation lists are relatively small. But they need to be available to every server (replication), be proof against server/service restarts (durable), and checked with every request (highly performant). So, a good revocation list effectively requires a database. Not a trivial thing to implement yourself, and a weighty requirement for an otherwise stateless service.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (106)

unscaled on March 14, 2017 | root | parent | next [–]


JWT are even smaller than their size since you can revoke them by hash (although you should really just revoke by user ID in most cases).

Your tokens should generally have a rather short lifetime - then you can keep the entire relevant window of revocations in memory.

The implementation is not trivial though, that's for sure.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (107)

justinclift on March 14, 2017 | root | parent | prev | next [–]


Hmmm, using a database (eg PG) for the authoritative information, with memcached in front sounds like it would be practical for most uses.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (108)

falcolas on March 14, 2017 | root | parent | next [–]


At which point you should probably ask yourself: "What value is keeping all of my state inside this token providing me?"

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (109)

mwpmaybe on March 14, 2017 | root | parent | prev | next [–]


Probably not. If the Pg instance is replicated, as indicated above, it'll be challenging to keep the Memcached copy in sync. In other words, you can't just use the caching feature of your ORM, you'll need another piece.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (110)

justinclift on March 14, 2017 | root | parent | next [–]


Thanks, that does need further thinking about. :)

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (111)

cygned on March 15, 2017 | root | parent | prev | next [–]


Postgres is not a good solution for this kind of data. I'd use Redis, but maybe there are even better products.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (112)

Chris2048 on March 14, 2017 | root | parent | prev | next [–]


Could you just have per-server tokens? Wouldn't a single client tend to hit just one server anyway?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (113)

dkersten on March 14, 2017 | root | parent | next [–]


Wouldn't a single client tend to hit just one server anyway?

No? Maybe? It depends on your load balancer. Assigning a client to a specific server is "sticky sessions". Many of us don't want to tie a client to a specific server and prefer a completely stateless 12-factor-style mechanism where any server can serve the client and stateless tokens provide a mechanism to achieve this.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (114)

tracker1 on March 14, 2017 | root | parent | next [–]


Not to mention the challenges with multi-region replication needs... to do this for every request along a server-server pipeline adds more latency still, since each request to the db means potentially 2-3ms on top of more complex requests, which all adds up.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (115)

Chris2048 on March 15, 2017 | root | parent | prev | next [–]


> and stateless tokens provide a mechanism to achieve this

without revocation. What's wrong with tieing a client to a server, or co-located server? Either they are close enough to share tokens / sync fast, or not?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (116)

dkersten on March 16, 2017 | root | parent | next [–]


What's wrong with tieing a client to a server, or co-located server?

Nothing, if you can get away with it. What do you do if your server dies or is overloaded? The 12-factor patterns came to be for services running on ephemeral hosts in cloud environments. Stateless servers mean you can seamlessly serve requests from another server without problem. Sure, you can store the sessions in a shared resource (redis perhaps?) but this complicated failover and redundancy and may add latency.

Maybe this isn't an issue, maybe it is. If you don't need or want that, then just use normal sessions, for sure.

Revocation can be handled (although admittedly not as well as with sessions or stored tokens) through short TTL's and refresh tokens (which are stored, but only need to be looked up when the stateless token expires). Its not perfect, but its often a good enough tradeoff.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (117)

rblatz on March 14, 2017 | root | parent | prev | next [–]


What if you are running dozens of services each specializing in its own domain? Do you proxy each service through a pool of central webservers? Or do you just stand up a central auth server and have each service trust that auth server?

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (118)

Chris2048 on March 15, 2017 | root | parent | next [–]


The latter makes sense to me. Auth is a cross-cutting concern.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (119)

elithrar on March 14, 2017 | parent | prev | next [–]


If you go so far as to maintain a revocation store that is checked on each request, you might as well just use that same store for full-blown server-side sessions.

By your measure, 1GB can store a lot of tokens in memory: 32B tokens + that again as metadata (e.g. user ID + TTL in Redis) = 15,625,000 tokens.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (120)

infogulch on March 14, 2017 | root | parent | next [–]


No, the session state itself may be orders of magnitude larger than an id. At 4 bytes per token you can store up to 250M ids per 1 GB. But session state might store kilobytes of data per user for roles, permissions, names, descriptions, links etc.

And you're overestimating the necessary size of a revocation store. Only a tiny fraction of your users ever log out or otherwise invalidate session via means other than TTL. You're looking at storing just a couple thousand 4-8 byte revoked session ids and ttls instead of gigabytes of session data.

If you have a security breach and need to invalidate all tokens, just reject all tokens with an issue date before it's fixed. And they all fall off anyway after a week (or however long the ttl is).

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (121)

tracker1 on March 14, 2017 | parent | prev | next [–]


Or better, have a really short lived requirement for server-server jwts (I suggest even 1m, having a new one per request).

For client-server a 5 minute refresh is fine, as long as you do a lookup for refresh, so you can expire refresh tokens, requiring a full re-auth.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (122)

lobo_tuerto on March 14, 2017 | prev | next [–]


I found this video incredibly informative about how to effectively implement JWTs, along with security advice and a nice refresh-reissue process:

https://youtu.be/mecILj3p4VA?t=2m8s

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (123)

> (1) Criticizing vulnerabilities in particular JWT libraries, as in this article.

The purpose of this article it criticize the standard, not particular libraries.

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab... (2024)

FAQs

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerab...? ›

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerabilities in particular JWT libraries, as in this article. (2) Generally criticizing the practice of using any "stateless" client tokens. Because there's no great way to revoke them early while remaining stateless, etc.

Is JWT vulnerable? ›

Signature Verification

One of the most serious vulnerabilities encountered with JWTs is when the application fails to validate that the signature is correct. This usually occurs when a developer uses a function such as the NodeJS jwt. decode() function, which simply decodes the body of the JWT, rather than jwt.

What are the shortcomings of JWT? ›

One of the most significant weaknesses of JWTs is their lack of encryption. JWTs are designed to be compact and self-contained, which means that the data within them is not encrypted. While they can be signed to ensure data integrity, sensitive information within a JWT remains exposed in plaintext.

What is wrong with JWT? ›

JWTs which just store a simple session token are inefficient and less flexible than a regular session cookie, and don't gain you any advantage. The JWT specification itself is not trusted by security experts.

What are the different types of JWT claims? ›

JWT claims

Claims constitute the payload part of a JSON web token and represent a set of information exchanged between two parties. The JWT standard distinguishes between reserved claims, public claims, and private claims. In API Gateway context, both public claims and private claims are considered custom claims.

Is JWT unsafe? ›

JWT token is not encrypted, it's just base64UrlEncoded. So, don't put any sensitive information in payload. Meaning, if for some reason an access token is stolen, an attacker will be able to decode it and see information in payload. Check it here.

What is the vulnerability of bearer token? ›

The Bearer Token's authentication occurred at the beginning of the token's life, and its TTL could be hours, if not days. This results in a security vulnerability for the rest of the duration of that token, because it could fall into the wrong hands.

What are common JWT mistakes? ›

JWT Errors
  • Invalid JWT Verifiers ID field. Error occurred while verifying params could not verify identity.
  • Failed to verify JWS signature. Error occurred while verifying params unable to verify jwt token.
  • Duplicate Token. ...
  • Expired Token. ...
  • Mismatch JWT Validation field.
  • Refresh Tokens?

What is safer than JWT? ›

Secure: Opaque tokens do not contain any user information, making them more secure than JWT tokens. Flexible: Opaque tokens can be customized to store additional user information in the authorization server, which can be retrieved by the resource server when needed.

What are the criticism of JWT? ›

The criticisms of JWT seem to fall into two categories: (1) Criticizing vulnerabilities in particular JWT libraries, as in this article. (2) Generally criticizing the practice of using any "stateless" client tokens. Because there's no great way to revoke them early while remaining stateless, etc.

What makes a JWT invalid? ›

The possible underlying root cause boils down usually to be one of these five possible reasons: invalid private key is used for the particular user. invalid login name is used for the particular user (if user's 'NAME' is different from 'LOGIN_NAME', then the latter must be used)

What is replacing JWT? ›

Paseto, which stands for Platform-Agnostic Security Tokens, is a specification for secure stateless tokens. It provides a modern and better alternative to JWT, addressing some of its inherent vulnerabilities and emphasizing secure defaults and ease of implementation.

Which is better than JWT authentication? ›

OAuth is suitable for delegating user authorization, accessing third-party applications, and session management. JWT is suitable for stateless applications, API authentication, and server-to-server authorization. Learn more about the key differences below.

What are the three things in JWT? ›

Anatomy of a JWT

Figure 1 shows that a JWT consists of three parts: a header, payload, and signature. The header typically consists of two parts: the type of the token, which is JWT, and the algorithm that is used, such as HMAC SHA256 or RSA SHA256. It is Base64Url encoded to form the first part of the JWT.

What is the difference between JWT and JSON? ›

The information contained within the JSON object can be verified and trusted because it is digitally signed. Although JWTs can also be encrypted to provide secrecy between parties, Auth0-issued JWTs are JSON Web Signatures (JWS), meaning they are signed rather than encrypted.

Can JWT tokens be hacked? ›

There is actually a pretty good reason for this wide adoption and that is, for the most part, security and resilience. However, just like any technology, JWT is not immune to hacking.

Can JWT tokens be stolen? ›

If someone steals the token, they can impersonate your user. We usually store JWTs in cookies, which makes us vulnerable to XSS and CSRF attacks. There are three important things to do: Use HTTPS - end-to-end TLS prevents someone intercepting or sniffing the requests on the wire and stealing the token.

Are JWT sessions secure? ›

JSON Web Token (JWT) serves as a compact and self-contained mechanism for securely transmitting information between parties as a JSON object. Crucial in frontend development, JWTs are used not just for authentication but also for information exchange, making understanding their nuances essential.

Is JWT token sensitive? ›

Description. Storing sensitive data in JWTs exposes it to potential security risks. JWTs are designed for transmitting data securely, not for storing confidential information. Guard against including sensitive data in a JWT payload.

Top Articles
5 Minute Intraday Trading System
What is a Ledger in Accounting? Is There a Difference with a Journal and a Ledger?
What Is Single Sign-on (SSO)? Meaning and How It Works? | Fortinet
Jennifer Hart Facebook
Online Reading Resources for Students & Teachers | Raz-Kids
Vaya Timeclock
Exam With A Social Studies Section Crossword
Hk Jockey Club Result
Volstate Portal
How do you mix essential oils with carrier oils?
Call Follower Osrs
Epaper Pudari
What Is A Good Estimate For 380 Of 60
Amelia Bissoon Wedding
Where does insurance expense go in accounting?
O'reilly's Auto Parts Closest To My Location
Dump Trucks in Netherlands for sale - used and new - TrucksNL
Erskine Plus Portal
سریال رویای شیرین جوانی قسمت 338
60 X 60 Christmas Tablecloths
Craiglist Tulsa Ok
Webcentral Cuny
Uktulut Pier Ritual Site
iZurvive DayZ & ARMA Map
Sni 35 Wiring Diagram
Loves Employee Pay Stub
Att.com/Myatt.
Mail.zsthost Change Password
Dallas Mavericks 110-120 Golden State Warriors: Thompson leads Warriors to Finals, summary score, stats, highlights | Game 5 Western Conference Finals
Walmart Near South Lake Tahoe Ca
Www.dunkinbaskinrunsonyou.con
CVS Health’s MinuteClinic Introduces New Virtual Care Offering
Craigslist Fort Smith Ar Personals
Jailfunds Send Message
CohhCarnage - Twitch Streamer Profile & Bio - TopTwitchStreamers
Pokemmo Level Caps
Green Bay Crime Reports Police Fire And Rescue
Consume Oakbrook Terrace Menu
oklahoma city community "puppies" - craigslist
Reading Craigslist Pa
Captain Billy's Whiz Bang, Vol 1, No. 11, August, 1920&#10;America's Magazine of Wit, Humor and Filosophy
Bones And All Showtimes Near Johnstown Movieplex
Florida Lottery Claim Appointment
Shell Gas Stations Prices
Sherwin Source Intranet
552 Bus Schedule To Atlantic City
CPM Homework Help
antelope valley for sale "lancaster ca" - craigslist
BYU Football: Instant Observations From Blowout Win At Wyoming
Ingersoll Greenwood Funeral Home Obituaries
Latest Posts
Article information

Author: The Hon. Margery Christiansen

Last Updated:

Views: 6007

Rating: 5 / 5 (50 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: The Hon. Margery Christiansen

Birthday: 2000-07-07

Address: 5050 Breitenberg Knoll, New Robert, MI 45409

Phone: +2556892639372

Job: Investor Mining Engineer

Hobby: Sketching, Cosplaying, Glassblowing, Genealogy, Crocheting, Archery, Skateboarding

Introduction: My name is The Hon. Margery Christiansen, I am a bright, adorable, precious, inexpensive, gorgeous, comfortable, happy person who loves writing and wants to share my knowledge and understanding with you.