jwt-attack-methodology

Decode JWT tokens and execute attacks like none-alg and weak-key brute force.

1.6k|234|Updated Dec 7, 2019
One-click install
npx skills add https://github.com/wgpsec/AboutSecurity --skill jwt-attack-methodology
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jwt-attack-methodology
Source: https://github.com/wgpsec/AboutSecurity/tree/main/skills/exploit/jwt-attack-methodology
Command: npx skills add https://github.com/wgpsec/AboutSecurity --skill jwt-attack-methodology

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

JWT攻击方法论。当响应头/Cookie 中出现 eyJ 开头的字符串、Authorization: Bearer token、API 返回 token/access_token 字段、Flask session cookie(eyJ 开头的 base64 编码 Cookie)时使用。包含 alg:none 绕过、弱密钥爆破(hashcat/john/c-jwt-cracker/jwt_tool/flask-unsign 完整工具链)、Claims 篡改提权、RS256->HS256 算法混淆、kid 注入(SQL/路径穿越/命令注入)、jku/x5u 替换。发现任何 eyJ 开头的 Cookie 或 Token 都应使用此 skill

Core Features & Use Cases

  • Phase 1: 获取和解码JWT:登录获取token,使用 jwt_decode 工具解码 Header、Payload、签名算法等。
  • Phase 2-6: 攻击向量集合:None-alg、弱密钥爆破、Claims篡改、RS256→HS256、kid注入、jku/x5u 替换。
  • 参考: references/jwt-advanced.md 获取更多 payload 与脚本

Quick Start

Analyze a target's JWT flow by decoding tokens and iteratively applying none-alg, weak-key brute force, claims tampering, RS256→HS256 confusion, and jku/x5u injections using the provided references.

Frequently Asked Questions about jwt-attack-methodology

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test JWT authentication for common security vulnerabilities?

JWT authentication security testing is performed by decoding tokens and executing targeted attacks like none-alg bypass, weak-key brute force, claims tampering, RS256→HS256 algorithm confusion, and jku/x5u header injections.

What is RS256 to HS256 algorithm confusion in JSON Web Tokens?

RS256 to HS256 algorithm confusion is an attack vector where a token using asymmetric RS256 is altered to symmetric HS256, allowing the attacker to sign new tokens using the server's public key as the HMAC secret.

How do I brute force a weak JWT secret?

To brute force a weak JWT secret, you decode the token and use utilities like hashcat, john, c-jwt-cracker, or jwt_tool to perform dictionary attacks against the HMAC signature to recover the signing key.

Can I perform kid injection attacks on JWT headers?

Yes, you can perform kid injection attacks on JWT headers by manipulating the key ID parameter to exploit SQL injection, path traversal, or command injection vulnerabilities within the token validation logic.

What tools do I need to execute a JWT attack methodology?

Executing a JWT attack methodology requires a JWT toolkit like PyJWT for decoding and signing tokens, alongside brute-force utilities such as hashcat, john, jwt_tool, and flask-unsign for cracking secrets.

When should I check for jku or x5u header injection in a JSON Web Token?

You should check for jku or x5u header injection when a JWT header contains URL references for public keys or certificates, allowing you to replace these URLs to point to an attacker-controlled server hosting a malicious key.