Password login accepts a sign-in that omits the password field
Description
Reported by Hinoki Security (cve-disclosures@hinoki.security)
Summary With require_password: true (the default), POST /auth without a "pass" field signs in as any existing user. No password is checked.
Affected potato-annotation 2.14.2 and master 310a267. Default config: require_password unset (true), in_memory auth, users registered with passwords.
Impact An unauthenticated client who knows a username gets that user's session. They can read and change that annotator's annotations. If rbac assigns the user the admin role, they also get the admin API (/admin/api/config, /admin/api/annotators, password resets, export).
Reproduction
- pip install potato-annotation==2.14.2. Start any task with the default require_password.
- Register alice@lab.example with a password and annotate an item.
- curl -i -X POST 127.0.0.1/
auth -d 'email=alice@lab.example&action=login' -> 302 with a session cookie for alice. /api/current_instance returns 200, and /annotate shows alice's saved labels. - Controls: a wrong password, pass= (empty) and an unknown user are all rejected. pass[]=x is accepted the same way as an omitted field.
Root cause (v2.14.2)
- potato/routes.py:908 password = request.form.get("pass") is None when the field is absent
- potato/authentication.py:690 with require_password true, the password is passed through unchanged
- potato/authentication.py:167 and :314 "if password is None: # Passwordless login" returns True
Suggested fix In UserAuthenticator.authenticate, return False when password is None and require_password is true. A tested patch with a unit test is available on request.