Having spent a lot of time researching, I am unable to confirm whether my system is secure enough.
- Users have a mobile phone and login to a central authorization server by passing their username, password and a nonce. The password both will be hashed
- Username, password will be pre-generated and given to the user through out-of-band methods. i.e. There is no registration page, and username, password that is assigned to a user will never be compromised
- User will receive a
jwtwith an expiry time of say 12 hours
- For any
getrequest, the user must add the
headeras per common standards
- The server can be trusted entirely
Now my doubts are,
- If someone intercepts the packets being sent from the mobile, he can get the
jwttoken, which can be used to send requests from a hacker. What prevents the hacker from sending requests by adding
jwtto his requests?
- If the incoming and outgoing packets from the mobile is breached during the login stage, the hacker will get access to the hash of the password (and salt) and username by reading the packets. What prevents him from sending that same data at a later point to the server and obtaining a
jwtof its own
I am assuming the hacker is extremely sophisticated.
One thing I thought of, is every time the user tries to login, a key exchange is initiated with the server, and is then used to exchange the password. So if this information is obtained, the hacker cannot use this to authenticate as encryption keys are ephemeral in nature.
Another easier option, is to have the server simply send a nonce, which the client will use to sign the password. This is unique to a single session, so once the user logs in, if a hacker sends that same signed password it will be rejected as the nonce on server side would have expired.
However, I am unable to protect myself in the eventuality that the
jwt token is accessed by the hacker.