How do I make JWT JSON Web Tokens more secure?

JSON Web Token

JWT tokens have recently become a very popular authentication method in web applications. While this is one of the safest ways to protect resources, and there are no alternatives on the market – keep in mind that every rose has spikes and there are many potential risks lurking here too. They are mainly due to implementation errors. To guard against them, it is worth sticking to the following rules:

  1. Make sure that you are using sufficiently complex encryption keys of at least 2048 bits.
  2. Create a procedure in case of leakage of the encryption key.
  3. Keys should be stored in a secure manner (e.g. they should not be in source code).
  4. A specific signature method should be required by the server so that it cannot be changed on the client side.
  5. Verify that your implementation does not allow the signature algorithm "none".
  6. Verify that your implementation is sure to check the signature (it does not accept a blank signature and distinguish between the functions "verify()" and "decode()" ).
  7. Verify that the debug mode is disabled and cannot be enforced on the client side.
  8. Do not submit JWT tokens in the URL.
  9. Verify that you do not disclose sensitive information in the JWT token.
  10. Make sure you're protecting yourself from a replay attack.
  11. Verify that the lifetime of the token is sufficiently short and that it is actually checked correctly.
  12. Consider whether or not you need the function of invalidating individual tokens.

Chcesz wiedzieć więcej?

Zapisz się i bądź informowany o nowych postach (zero spamu!).
Dodatkowo otrzymasz, moją prywatną listę 15 najbardziej przydatnych narzędzi (wraz z krótkim opisem), których używam przy testach penetracyjnych.

Nigdy nie podam, nie wymienię ani nie sprzedam Twojego adresu e-mail. W każdej chwili możesz zrezygnować z subskrypcji.

Bookmark the permalink.

Podziel się swoją opinią na temat artykułu