You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the created user, we will login to the application with their credentials to get the JWT token. As it is a test application, the JWT token is returned to the user as soon as he is logged in.
However, the API does not verify the signature used by the JWT token, any malicious user can create a fake token, as shown by the image:
93
93
94
94
<palign="center">
95
-
<img src="images/attack_6.png"/>
95
+
<img src="images/attack_5.png"/>
96
96
</p>
97
97
98
98
```sh
99
99
curl -s -H 'Content-Type: application/json' -H 'Authorization: Bearer eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJ1c2VybmFtZSI6Imphc29uVm9vcmhlc3MiLCJleHAiOjE2MzMzODM1ODZ9.' -d '{"title": "New member ", "post": "Today a new member ..."}' http://localhost:20001/newpost
100
100
```
101
101
102
102
<palign="center">
103
-
<img src="images/attack_5.png"/>
103
+
<img src="images/attack_6.png"/>
104
104
</p>
105
105
106
+
106
107
## Secure this app
107
108
108
109
How would you mitigate this vulnerability? After your changes, an attacker should not be able to:
109
110
110
-
* Check and validate JWT Token signature.
111
+
* Use fake tokens without a valid signature.
112
+
* Impersonate other users through manipulation of the JWT.
0 commit comments