There are some types of attacks in JWT. I think it is nice to add a test case scenario for that.
Yes, definitely. I think this fits in sessions chapter. It was to be implemented as new additions were coming to APIs.
@kingthorin @scalzava do you agree on the location of this? What are your thoughts on it?
Note: This will impact #370 and allow that test to link to the JWT test scenario.
Yeah, it should definitely belong to the session management chapter. That would be a great addition to the guide, which I look forward to read! Yet, the right presentation is far from obvious IMHO.
We should be careful on the definition of JWT security. If JWTs are stored in cookies, they largely inherit the same weaknesses of traditional cookie-based sessions. The concern is really providing suggestions on how to craft these JWTs correctly. But if JWTs are saved in web storage, the threat model changes considerably: for example, CSRF is not a concern anymore and one (obviously) cannot rely on standard cookie defenses like HttpOnly and Secure. To sum up:
Incidentally, Section 3.1 (Misconceptions) of the paper formalizes my prior point on this discussion in nice academic writing. All things considered, we probably need two separate sections for 1 and 2 above, since the concerns are different. What do you think, @ThunderSon?
I agree with both points. When I say let's discuss JWT, it means the weaknesses in that implementation, so point number 1.
For point number 2, the closest I found in the guide was CLNT-12, but it doesn't discuss in details the differences for sessions.
No worries about self plugs, at least we know they're good content :)
Does this feel like a section dedicated for JWT would be good, or should we handle them as "session tokens" and discuss different types (opaque tokens would be another one)?
@rbsec what do you think about this?
Let’s not confuse JWT with session tokens, there are lots of arguments against using them as such. (Though I’m happy to be proven wrong.)
Just search something like “ jwt are not session tokens”.
Given the number and variety of attacks/weaknesses I’d almost be happy with a separate section. Although maybe we are better with deeper split sections like SQLi?
My thoughts would be that there are a lot of JWT specific issues that need to be tested for, such as:
none (or NoNe signature algorithm)?I think that these could easily justify a section of the guide - and these issues aren't really specific to how the JWT is stored.
In terms of the issues related to using local/session storage for tokens, is there anything specific that isn't already covered in guide linked to by @ThunderSon? If so, it probably wants adding there, rather than to a JWT page.
In terms of arguments about whether you should use JWTs or the merits of browser storage vs cookies, that seems like it would be outside of the scope of a project like this? I wouldn't consider any of them to be fundamentally broken to the point that a pentester should be recommending "Do not use JWTs" or "Do not use browser storage" - so as long as we have a methodology to test the security of all of them then I think a discussion of their merits is better left to other projects.
so as long as we have a methodology to test the security of all of them then I think a discussion of their merits is better left to other projects.
I agree, whole heartedly.
So, if I get the discussion correctly, it seems that:
Is this an appropriate summary? Also, I agree with the final statement of @rbsec: we don't want to start a cookie vs storage fight. However, the choice of the storage does have security implications. This impacts security testing strategies and should be taken into account in the threat modeling phase. I'm unsure we should consider this as out of scope, but I trust @kingthorin and @ThunderSon as chief editors on this.
@scalzava do you think there's anything significant that you feel is missing from the existing browser storage testing guide that should be added? If so, it's probably worth opening a separate issue/PR for that - so this issue doesn't get too mixed up with not-JWT stuff.
I'd say the "browser storage testing guide" is not really a testing guide :) Of course, no offense meant to anyone - it just sounds more like a general introduction to client-side storage. I think it can be improved, though I would need to reason about it more formally. I do agree that we should reserve this issue to JWTs alone and open a new issue for authentication credentials in web storage if we feel the need (not sure it's a top priority right now).
As JWT Website said: JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Also it can be use for authentication and authorization and even mostly in API for authentication. So it is hard to tell exactly which chapter is better for this. I'm agreed that it should be separated in different parts like SQL Injection.
I think my comment made things go into various directions. Let me go into more details.
One thing is that we're all in agreement about JWT testing. The bad implementations, how it can be messed up, etc.
JWT can be part of AuthN, AuthZ, APIs, and Sessions. Once the test scenario is written, it can be referenced in other sections. But, this is just "modeling". Let's see where it fits later while work is happening on it.
I suggest that work starts happening, and we'll see how we can make it grow. I don't mind starting with one document, and then see if it should be split up. Again, this is something similar to "Testing JWT Implementations", and not their storage techniques in the browser. Mainly relying on rbsec's comment.
If we're in agreement on the final suggestion, @kousha1999 would you like to work on this?
Worth noting that there's already some (fairly high level) JWT testing guidance, but it's not in the main document:
https://github.com/OWASP/wstg/blob/master/Testing_for_APIs.md#specific-testing--token-based-authentication
@ThunderSon I would love to but I'm not fluent in English, So it is so hard for me to write something like that by myself, thus I need so much help. I think it is better to someone work on it and I'll help him.
@ThunderSon @kousha1999 I can help with this issue. I am fairly new in terms of contributions but I think I can manage this section.
Most helpful comment
Worth noting that there's already some (fairly high level) JWT testing guidance, but it's not in the main document:
https://github.com/OWASP/wstg/blob/master/Testing_for_APIs.md#specific-testing--token-based-authentication