Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Security] Reject remember-me token if UserCheckerInterface::checkPostAuth() fails#24536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| returnnewRememberMeToken($user,$this->providerKey,$this->secret); | ||
| $token =newRememberMeToken($user,$this->providerKey,$this->secret); | ||
| if (!$token->isAuthenticated()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Won't the token always be not authenticated becausesetAuthenticated() is now never called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
yeah, just found that out.... working on a fix
weaverryan commentedOct 12, 2017
I wonder if the fix should be that when you are logged in via |
kbond commentedOct 12, 2017
Yeah, I jumped the gun on this PR... Discovered the remember me service has no way of knowing if the user has changed because the user isn't serialized. We could clear the remember me cookie as part of the |
weaverryan commentedOct 12, 2017
Hmm... but this seems like a separate issue, right? Right now, if my session expires, and I am "saved" by RememberMe, but my user has actually changed, then I will still be logged in. Aka, this is already an issue with remember me and unrelated, right? I don't think the "remember me" token could ever know if the user was changed... because (by its very nature), it is being activated because there is no user in the session... and so nothing to compare with. So is that fixable, or just the nature of remember_me? i.e. if you use remember_me, you're giving anyone with this cookie a "free pass" to login until that remember_me cookie expires (if you use the default way that remember_me works, where you just decode the cookie and load the user). |
kbond commentedOct 12, 2017
What about running the user through the |
weaverryan commentedOct 12, 2017
@kbond Hmm, indeed, that's a good idea. Let's try it. We may need a BC layer, but maybe not - it smells like a bug that a "disabled" user could become logged in thanks to their remember_me token. |
kbond commentedOct 12, 2017
Ok, I'll update this PR |
kbond commentedOct 12, 2017
This ended up being a pretty simple fix. |
chalasr commentedOct 12, 2017
|
weaverryan commentedOct 12, 2017
Here are some details on why that old change was made:https://github.com/symfony/symfony/pull/11058/files#r18096092. Specifically, |
kbond commentedOct 12, 2017
Ok switched the base branch to 2.7 |
weaverryan commentedOct 12, 2017
Yea... to say more, if the User was disabled (as you mentioned#24525 (comment)), that would be caught in |
kbond commentedOct 12, 2017
I do my disabled user check in |
weaverryan commentedOct 12, 2017
Well, that's a good enough reason for me. Just to verify, with this patch, do you get the desired effects if you try in your real app? |
kbond commentedOct 12, 2017
Yes, my real app works as expected. I think if you have different behavior based on an exception thrown in |
weaverryan commentedOct 12, 2017
👍 from me. This is a slight behavior change, but it's fixing a (security) bug imo: you should never want a remembe_me cookie to authenticate a user that fails the user checker (the default The distinction between pre-auth checks (checks that are done before checking credentials, and so are so errors are exposed to the user) and post-auth checks is not relevant here: both should be checked. |
fabpot commentedOct 13, 2017
Thank you@kbond. |
…e::checkPostAuth() fails (kbond)This PR was merged into the 2.7 branch.Discussion----------[Security] Reject remember-me token if UserCheckerInterface::checkPostAuth() fails| Q | A| ------------- | ---| Branch? | 2.7| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#24525| License | MIT| Doc PR | -I think this is a security hole - a user can remain logged in with a remember me cookie even though they can no longer pass `UserCheckInterface::checkPostAuth()` (could be disabled).This is a small BC break but shouldn't be an issue as I think it is a bug. I don't think this requires a BC layer but if so, I can add.Commits-------fe190b6 reject remember-me token if user check fails
Uh oh!
There was an error while loading.Please reload this page.
I think this is a security hole - a user can remain logged in with a remember me cookie even though they can no longer pass
UserCheckInterface::checkPostAuth()(could be disabled).This is a small BC break but shouldn't be an issue as I think it is a bug. I don't think this requires a BC layer but if so, I can add.