Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

JWT Attack Playbook HS Advice for RS Algorithm #88

Open
joswr1ght opened this issue Nov 2, 2022 · 0 comments · May be fixed by #89
Open

JWT Attack Playbook HS Advice for RS Algorithm #88

joswr1ght opened this issue Nov 2, 2022 · 0 comments · May be fixed by #89

Comments

@joswr1ght
Copy link

When using a playbook scan, I thought it odd that jwt_tool suggests HS attacks when the algorithm is RS (and doesn't suggest RS attacks):

$ python jwt_tool.py -rh 'Authorization: Foo eyJhb...' -t 'https://test-target.willhackforsushi.com/api/v1/capabilities' -M pb
...
Token header values:
[+] alg = "RS256"
...
LAUNCHING SCAN: JWT Attack Playbook
...
The following additional checks should be performed that are better tested manually:
[+] Try testing HS token against weak password configurations by running the following hashcat cracking options:
(Already testing against passwords in jwt-common.txt)
Try using longer dictionaries, custom dictionaries, mangling rules, or brute force attacks.
hashcat (https://hashcat.net/hashcat/) is ideal for this as it is highly optimised for speed. Just add your JWT to a text file, then use the following syntax to give you a good start:

[*] dictionary attacks: hashcat -a 0 -m 16500 jwt.txt passlist.txt
[*] rule-based attack:  hashcat -a 0 -m 16500 jwt.txt passlist.txt -r rules/best64.rule
[*] brute-force attack: hashcat -a 3 -m 16500 jwt.txt ?u?l?l?l?l?l?l?l -i --increment-min=6
[+] Try waiting for the token to expire ("exp" value set to: 2022-11-02 07:57:35 (UTC))
Check if still working once expired.

It looks like lines 1514 and 1518 check headDict['alg'] for the algorithm type, but this value is changed somewhere else (also noted at line 1377 where is is saved as origalg).

This is a tiny issue, PR incoming.

joswr1ght added a commit to joswr1ght/jwt_tool that referenced this issue Nov 2, 2022
zi0Black added a commit to zi0Black/jwt_tool that referenced this issue Nov 8, 2023
Fix ticarpi#88 in playbook scan, changing algorithm reference to use `origalg`
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant