-
Notifications
You must be signed in to change notification settings - Fork 8
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MFA Session cookie and MFA resource evations prevention #20
base: main
Are you sure you want to change the base?
Conversation
Thanks for the contribution!
I have never personally needed this, but it seems to be a common request. So I think this is a useful addition, especially considering your next point. I am wondering whether we should also provide a This does need some documentation though.
I really like this idea. My only comment is on the name of the mixin.
I am really not convinced by this yet:
Maybe I am missing something. Can you explain the benefits of using a separate session for MFA? In general, it would make my life easier if you could split the changes into multiple commits (one for each of these points and also split out unrelated style changes) and add some tests. I am looking forward to your response. This is great stuff! |
hey @xi
I was wondering that having all in a single commit would be more easy to read, but I can redo the work if this is necessary. Let's continue our discussion on separating the session, I can also purpose an option for implementers that doesnt want this (default, without breaking changes) with implementers that wants this (me). A simple approach based on thank you for the quick reply, this is very promising for the next release |
@xi I have finally applied your code review in this commit
I look forward for your kindly feedback and the merge of this PR for the next release |
I had another look at this and I get the feeling that it doesn't actually tackle the heart of the problem. Consider these cases:
In summary, I think this does more harm than good. A better option could be to require re-authentication for managing keys. To prevent users from locking themselves out we could have exceptions for keys that have been created during the current session. I understand that this would be very different from what you implemented. I am also not sure if that would be a good fit for this library. But I am open for ideas! Let me know what you think and if you want to continue working on this issue. I still think there is a lot of potential, it is just much harder than I first anticipated. |
required starting with django 5.0
thank you for the time spent on this PR @xi. Point by point:
we could set a timeout on the
this leds to the credential provisioning. Does an admin of the platform be forced to create a code and a recovery code as well to be provided to new users OR the user must create its 2fa on the first access (if MFA is mandatory). This touches UX strategies, I would keep this out of the scope of this PR for now.
This leds to security vs. UX. This procedure may led to the security protocol for the users locked out. If you agree we can add an option to enable the additional check proposed by this PR or not. From the current perspective this PR should be considered to avoid an attacker to login and remove the 2fa with the sole submission of username/password. The case of the user locked out should be resolved with a ticker or an additional security protocol, not technical but administrative. This may depend on the internal policies and provisioning mechanisms.
A collegue of mine has suggested exactly this. Even this has its security vs UX cons. We can do that, we must decide how.
ok, can we get this PR merged on a dev branch and continue the developments in this direction? We can add an additional identifier in the mfa_session with the pks of the 2fa created during the current session. When you say "exception for keys" what do you exactly mean?
I fully agree with you, we're facing the security vs. UX issues that MFA brings with itself. I would merge this PR as it is stable and, without tagging a new release, create the user stories in the form of issues, to have a clear approach and analysis on the UX and on the security impacts we might have. |
But that is already impossible. If a key exists, it must be used during login. Sure, some security-in-depth would be nice to prevent issues like CVE-2022-24857. But if an attacker can bypass MFA during login they gain nothing from removing the keys. They can already log in.
To be clear: I will not merge this pull request. As I see it, the alternatives that we discussed would share very little code with this approach. So I see no benefit in merging this. Here is a rough outline of what we need instead:
|
I want to use this library and give my support for the improvement of the security of the solution. This is my priority (the what). Then I have to work with you for the implementation of the solution (the how). The What (problem statement)scenario A scenario B How (solution statement)this PR introduces an additional checks for the user profiles with 2fa enabled: the user can list and delete her/his 2fa onlt if authenticated with a 2fa. Otherwise, if the user doesn't have created yet a 2fa he/she can create a 2fa. Roadmap (actionable agreement and task to be done)The task marked with [x] are agreed and well understood. The unmarked ones requires further discussion/understanding to get developed and then done.
@xi let's continue working together for an agreement, time is our allied. Thank you for your time and attention to this PR, we can do it together. |
thank you @Qadeem411 for you kindly revision and approval, I just have updated this PR with the resolution of the merge conflicts |
Can you provide a working proof of concept how an attacker would bypass the two factor authentication? If that were possible, that would be a major security issue. But so far I cannot see how that would be possible. |
2b4c3ed
to
7be4d30
Compare
Can we get this merged soon please? |
The good @lorenzo4securitas tested some webpath evasion and then we decided to add some additional checks.
This PR
mfa_authenticated
to enable additional filters for the protection of the MFA endpointsmfa_authenticated
, and not just by using the generic django user logged in check; according to the following approach: