-
Notifications
You must be signed in to change notification settings - Fork 110
Bypass 2fa with remember-me option #253
Comments
Ouch, I can confirm that unfortunately. And I don't have a clear plan (yet) how to fix this issue properly. I did some research and right now it looks the best approach would be to decorate the firewall's /summon @chalasr Do you have and idea how we can solve this? |
Well it happens :-) Found it, ( well actually more like, though of the theoretical issue ) while investigating another problem in our application. I've did a bit of research also, but my knowledge of the login process ( and abstract services) is limited. I found a RememberMeTokenProvider. And my guess would be to override the Symfony's default one. When the 2fa is succes, we should check the variable / attribute in the token and trigger the RememberMeTokenProvider of Symfony. |
Yes, something like that would be the solution to set the remember me token after 2fa has been completed. The issue that I'd like to solve first is how to avoid the cookie to be set right after login. The way this is implemented, it's outside of the bundle's control and I'm wondering what the best approach would be to hook in and prevent it. |
@scheb I think you could inject the |
…ion is required, fixes "Bypass 2fa" #253
…ion is required, fixes "Bypass 2fa" #253
…ion is required, fixes "Bypass 2fa" #253
…ion is required, fixes "Bypass 2fa" #253
…ion is required, fixes "Bypass 2fa" #253
Thanks, deployed the fixed version |
Thank you @scheb! |
@scheb Thanks a lot! |
Description ----------- See scheb/two-factor-bundle#253. Commits ------- c55fe7e Bump scheb/two-factor-bundle version to ^4.11 f7efee2 Adjust version constraint
Description ----------- See scheb/two-factor-bundle#253. Commits ------- c55fe7e2 Bump scheb/two-factor-bundle version to ^4.11 f7efee2d Adjust version constraint
Is it possible to tell when it was introduced? Or was it there forever? |
I haven't tested every version of the bundle with every version of Symfony, but the way this issue works very likely affects all versions from 3 until 3.26.0 and all versions from 4 until 4.11.0, independent of the Symfony version. And now that I think about it, all versions from 1.x and 2.x, which depend on a session flag to ask for 2fa, probably have and still have this issue. |
@scheb I'm here because I also discovered this behaviour yesterday myself, but I was going to report it privately through the direct email. Wondering if issues like that should be considered as highly sensitive security bugs. |
Bundle version: 4.10.0
Symfony version: 3.4.31
Description
Bypass 2fa by rememberme cookie
To Reproduce
We have a login form with remember_me (checkbox) functionality, When using the checkbox, symfony creates a cookie "REMEMBERME". That moment we get redirected to the 2fa-auth page. We have no access to the other pages. On that moment, when we remove our SESSIONID key with the browsers cookie inspector/tool, we can go to our homepage "/" and be IS_AUTHENTICED_REMEMBERED. Effectively being logged in without 2fa.
The text was updated successfully, but these errors were encountered: