xyz icon indicating copy to clipboard operation
xyz copied to clipboard

Attempts to Crack JSON Web Token Secret Key

Open dbauszus-glx opened this issue 1 year ago • 1 comments

After logging in, users receive a JWT (JSON Web Token) as an authentication cookie, consisting of the following three parts encoded in Base64:

  • Header
  • Payload
  • Signature

If a weak secret key is used, particularly with HS256 (HMAC with SHA-256) as the algorithm for token signing, an attacker could potentially brute force it. This vulnerability arises specifically due to the characteristics of HS256, and it's important to note that this scenario is not applicable to algorithms like RS (RSA) where a different set of security considerations come into play.

dbauszus-glx avatar Feb 02 '24 12:02 dbauszus-glx

Changing the algorithm to RSA256 will require an asymmetric key read from a file.

dbauszus-glx avatar Feb 02 '24 17:02 dbauszus-glx