Educational PoC for an alg:none signature-bypass class in JWE-wrapped JWTs (pac4j-jwt)
alg:none Signature Bypass for JWE-Wrapped JWTs (CVE-2026-29000)ACHTUNG - Disclaimer — read first
This software is provided for educational purposes and authorized security testing only — against systems you own or for which you have explicit, written permission. Unauthorized access to computer systems is illegal. The author accepts no liability for misuse or for any damage caused by this tool. By using it, you accept full responsibility for your actions. This repository contains no target-specific data; it is a demonstration of a vulnerability class, built against a disposable lab instance.
A proof-of-concept tool that forges authentication tokens for applications which wrap a signed JWT inside a JWE (JSON Web Encryption) and then fail to properly verify the inner signature.
It targets the vulnerability class behind several real pac4j-jwt
misconfigurations: the server derives trust from being able to decrypt a token,
even though anyone holding the public key can produce a valid ciphertext. When
the inner JWT is additionally accepted with alg: none, signature verification
disappears entirely and arbitrary claims — including elevated roles — are trusted.
This PoC demonstrates the authentication-bypass class tracked as
CVE-2026-29000, an
authentication-bypass vulnerability in pac4j-jwt 4.x, 5.x and 6.x. The public
advisory classifies it as an authentication bypass; this tool shows one concrete
path — an alg:none inner JWT inside a self-encrypted JWE — and an optional
RS256-to-HS256 key-confusion variant. Verify the exact affected versions and fix
against the vendor advisory before relying on this in a report.
A common design encrypts the outer token with the server's public key (for example RSA-OAEP-256 + A128GCM) and signs the inner JWT with RS256. These two layers protect different things, and only one of them proves authenticity:
/jwks endpoint), any party can produce a correctly encrypted token. The
outer JWE therefore says nothing about who created the token.alg: none, there is no signature to verify and the claims are
taken at face value.Either way, an attacker can mint a token with any claims (e.g. an admin role) using only public information and without valid credentials.
alg: none (no signature) or, in confusion mode, with
HS256 using several serializations of the public key as the HMAC secret.cty: JWT) encrypted to the public key.The multi-candidate confusion mode is the main addition over a minimal PoC: it reports the result of every attempt instead of failing silently, which makes it usable as a quick test across differently-configured targets.
git clone https://github.com/tscherwinski/CVE-2026-29000-jweforge.git
cd CVE-2026-29000-jweforge
pip install -r requirements.txt
Only generate a token:
python3 jwe_forge.py --jwks https://lab.example.local/api/auth/jwks \
--user admin --role ROLE_ADMIN
Generate and test directly against endpoints:
python3 jwe_forge.py --jwks https://lab.example.local/api/auth/jwks \
--target https://lab.example.local \
--endpoint /api/users --endpoint /api/settings
Try both attack modes (alg:none and HS256 confusion):
python3 jwe_forge.py --jwks https://lab.example.local/api/auth/jwks \
--target https://lab.example.local --endpoint /api/users --mode auto
Key options:
| Option | Meaning |
|---|---|
--jwks | JWKS endpoint URL (required) |
--user / --role | sub and role claims to put in the token |
--issuer | iss claim (match the target's expected issuer) |
--mode | none (default), hs256, or auto |
--target | base URL for live testing (optional) |
--endpoint | path to test, repeatable (optional) |
none explicitly.pac4j / JOSE libraries up to date and review their signature-validation
configuration.MIT — see LICENSE.