Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Authentication succeeds without verifying prefix from LDAP on autoprovision #9

Open
jralbert opened this issue Feb 17, 2017 · 2 comments

Comments

@jralbert
Copy link

If a user that's either new or has no yubikey prefix assigned in yubiauth attempts to authenticate to yubiauth with user/pass credentials that successfully validate to LDAP, and an OTP that successfully validates to the YK validator service, they will be autoprovisioned from LDAP if the configuration is set to allow it - but on that first request authentication will succeed, even if the (valid) token provided doesn't have the prefix that the user's LDAP record specifies. Further requests will fail, because the prefix store in yubiauth doesn't match the one specified in LDAP.

This would mean that an attacker who can obtain a valid user/pass credential pair and ANY valid yubikey can successfully authenticate to yubiauth at least once - more if they can delete the user record after it's created.

This comes down to behaviour in the authenticate_otp function in client/controller.py: if the user already has a key provisioned, the function calls user.validate_otp(otp, password), which correctly checks the prefix against LDAP; but if they don't already have a yubikey provisioned, then the function assigns the current key's prefix to their yubiauth record and immediately returns True. This is in error. Instead, line 67 should replace "return True" with "return user.validate_otp(otp, password)", which would match the existing prefix behaviour as above.

Please let me know if there's any additional information you need from me on this.

@dainnilsson
Copy link
Member

I'm not sure I follow. What I think you're saying is that USE_LDAP, LDAP_AUTO_IMPORT, and AUTO_PROVISION are all enabled, is that correct?
Then you're saying that a call to Client.authenticate() with a valid username and password, and any valid OTP for YubiCloud (or whichever OTP validation server you've configured) allows the user to authenticate once? If so, that is the intended behavior when AUTO_PROVISION is enabled. A user self-enrolls a YubiKey by authenticating with it once, thereby enabling (and subsequently enforcing) 2FA for the account.
Am I misunderstanding anything?

@jralbert
Copy link
Author

jralbert commented Feb 21, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants