elthran / RPG-Game

0 stars 1 forks source link

Fix password reset security hole. #328

Closed klondikemarlen closed 6 years ago

klondikemarlen commented 6 years ago

How to access:

  1. Wait for user to reset their password.
  2. Send a POST request to the /reset page with the appropriate request.form['username'] and whatever request.form['password'] you want their password to be.
  3. Login with the password you created.

NOTE: you have 5 minutes to do this after they put their account in reset mode.

Probable fix:

  1. Modify the reset page get request to embed the reset key in it. return render_template("reset.html", username=request.args['user'], reset_key=request.args['key'])
  2. Store that in a hidden form element. <input class="hide" type="text" name="reset_key" value="{{ reset_key }}" />
  3. Return it with the POST request.
  4. Verify the key before processing the post request if database.validate_reset(request.form['username'], request.form['reset_key'])):
klondikemarlen commented 6 years ago

Fixed in https://github.com/elthran/RPG-Game/commit/3bd2b76814a435f603b5de0e50760a981556b4c8