Skip to content

Multiple valid signatures for when signing with HS256 #269

Closed
@note

Description

@note

According to @lhazlewood suggestions from #123 I am using 64 bytes key for HS256 and I am still having similar problem as it was described here: #123.

I created repo with minimal reproducer: https://github.com/note/jjwt-report. You can either clone the whole repo and run it with sbt or just copy paste https://github.com/note/jjwt-report/blob/master/src/main/java/example/Hello.java to your project.

What is interesting is that finding a collisions like this is very simple - I came across the problem just because I was testing automatically my method. In my test I was generating some JWT token, changing last character in the token and expecting validation of such token to fail. Still in around 10% of cases it was actually passing.

Was also trying with 128 bytes key and it still was the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions