Skip to content

Commit

Permalink
Fixed missing urlsafe_b64 decoding in validateToken()
Browse files Browse the repository at this point in the history
Thanks to DidierA and c-sh0 for spotting this!
  • Loading branch information
ticarpi authored Jun 18, 2020
1 parent a88a8c5 commit 09fb9e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jwt_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1204,12 +1204,12 @@ def validateToken():
contents = tok1+"."+tok2
contents = contents.encode()
try:
head = base64.b64decode(tok1 + "=" * (-len(tok1) % 4))
head = base64.urlsafe_b64decode(tok1 + "=" * (-len(tok1) % 4))
except:
print("[-] Invalid token:\nCould not base64-decode header - incorrect formatting")
exit(1)
try:
payl = base64.b64decode(tok2 + "=" * (-len(tok2) % 4))
payl = base64.urlsafe_b64decode(tok2 + "=" * (-len(tok2) % 4))
except:
print("[-] Invalid token:\nCould not base64-decode payload - incorrect formatting")
exit(1)
Expand Down

0 comments on commit 09fb9e5

Please sign in to comment.