Authentification API - Pentesting Web

Authentification API

Pour se connecter :

curl -s -X POST http://secret.htb:3000/api/user/login -H "Content-Type: application/json" -d '{
    "email": "[email protected]",
    "password": "jordan"
}' ; echo

Cela nous retourne un token d'authentification (auth-token).

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NzIxZjE5ZmQ4YWMzZTA0NjMxZjc4NmQiLCJuYW1lIjoiam9yZGFuIiwiZW1haWwiOiJqb3JkYW5AaHRiLmNvbSIsImlhdCI6MTczMDI3ODEyM30.z6quBZ6bTMSrkl7NxIfLEL0gUw6Wjvm3HWdnlhZBUoQ

Vérification du Json Body par défaut

email: "[email protected]"

password: "Kekc8swFgD6zU"

Vérification vulnérabilité JSON Web Token

Utilisez un site pour décoder le JWT afin de lire et manipuler son contenu.

Note : Le token JWT devrait être invalide. En modifiant les champs "name" et "email" pour ceux d’un administrateur :

"name": "theadmin",

"email": "[email protected]",

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NzIxZjE5ZmQ4YWMzZTA0NjMxZjc4NmQiLCJuYW1lIjoidGhlYWRtaW4iLCJlbWFpbCI6InJvb3RAZGFzaXRoLndvcmtzIiwiaWF0IjoxNzMwMjc4MTIzfQ.yn6hXmpBxrfb5TMDY4_6zirckzlhnQP_L_YWb4wL2Ug

Tentative d'accès à une API privée:

Essai de connexion à une API privée en utilisant le JWT modifié :

Nous recevons un message "invalid token".

Avec notre propre JWT, nous avons un accès en tant qu’utilisateur normal :

Nous recevons un message "You are normal user".

Mis à jour

Ce contenu vous a-t-il été utile ?