Skip to content
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

Remove account lockout from failed recovery attempts #35325

Merged
merged 5 commits into from
Jan 24, 2024

Conversation

jentfoo
Copy link
Contributor

@jentfoo jentfoo commented Dec 4, 2023

This account lockout looks to be unnecessary and potentially problematic. Recovery codes and recovery through MFA are not possible to brute force.

In addition the potential to lockout an account from being able to use a recovery method could result in them being unable to unlock their account from other potential abuse cases (for example an attacker locking the account from failed password attempts).

For that reason I believe we should remove this lock as part of Teleport 15. Opening this PR for discussion, please highlight if there are any concerns which motivated this account lockout and which I may have missed.

@jentfoo jentfoo self-assigned this Dec 4, 2023
@github-actions github-actions bot added rfd Request for Discussion size/sm labels Dec 4, 2023
Copy link

github-actions bot commented Dec 4, 2023

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@jentfoo jentfoo added the no-changelog Indicates that a PR does not require a changelog entry label Dec 4, 2023
lib/auth/accountrecovery_test.go Show resolved Hide resolved
lib/auth/accountrecovery.go Show resolved Hide resolved
lib/services/identity.go Show resolved Hide resolved
rfd/0029-account-lifecycle.md Outdated Show resolved Hide resolved
Copy link
Contributor

@russjones russjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jentfoo Can you link me to the RFD where this change was discussed and approved?

@jentfoo
Copy link
Contributor Author

jentfoo commented Dec 5, 2023

@russjones The only RFD changes are the removal of the requirement from the existing RFD. As mentioned in the description I opened this PR to prompt exactly that type of discussion.

To reiterate the motivation for bringing this change up for discussion:

  1. There is currently the potential for a targeted attack on a user to result in locking that user locked out and unable to recover. Removing this mechanism would ensure our users have a means to access their account even in the case of a targeted attack.
  2. There is not an obvious need to a lock out on recovery failure. Recovery methods appear to be system controlled and high enough entropy to be brute force resistant.

Let me know what additional details you would like to have captured, and what your thoughts around this change are. Thank you!

@russjones
Copy link
Contributor

@jentfoo Is this tied to a compliance goal or issue that will reach it's SLA if not addressed?

@jentfoo
Copy link
Contributor Author

jentfoo commented Dec 6, 2023

@russjones There is a potential DoS risk here in that a user can be targeted and prevented access to their account. However we have not filed a report against it yet. I wanted to submit this PR for discussion and to explore if this is something we can improve.

If you would like me to file an issue to link to this, I can do that. I just thought this was a better way to open up the discussion.

@jentfoo
Copy link
Contributor Author

jentfoo commented Dec 6, 2023

@russjones The report that motivated this PR is now filed under https://github.com/gravitational/security-findings/issues/75

Let me know if you have any additional questions, or feedback on this change. Thank you!

@russjones
Copy link
Contributor

@jentfoo Please propose changes via our RFD process if you want to change the behavior of Teleport.

@jentfoo
Copy link
Contributor Author

jentfoo commented Dec 8, 2023

@russjones I submitted the RFD under the PR here: #35533

The RFD is fairly light in content because this is a relatively isolated change, but hopefully it will provides a better description of why we want to make this improvement. Please let me know your thoughts and questions, thank you!

@jentfoo
Copy link
Contributor Author

jentfoo commented Jan 9, 2024

@zmb3 and @codingllama, I have partially updated this PR. This will depend on the e update I just submitted here: https://github.com/gravitational/teleport.e/pull/3118

I would appreciate a look around the API changes (mostly captured in the most recent commit). I believe I have removed all possible API as discussed in the RFD. I have kept the RecoveryAttemptLockExpires field in the protobuf but renamed as DEPRECATED, let me know if there is a more standard way to maintain compatibility with these changes. Thank you!

Copy link

github-actions bot commented Jan 9, 2024

🤖 Vercel preview here: https://docs-lmolodche-goteleport.vercel.app/docs/ver/preview

Copy link

github-actions bot commented Jan 9, 2024

🤖 Vercel preview here: https://docs-laqayemcy-goteleport.vercel.app/docs/ver/preview

(gogoproto.nullable) = false,
(gogoproto.jsontag) = "recovery_attempt_lock_expires,omitempty"
];
reserved 5; // removed RecoveryAttemptLockExpires after lockout was removed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually I see these reserve blocks at the top of the message - but unsure if that's a standard thing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK this goes either way. Not sure if we have a consensus.

@jentfoo jentfoo force-pushed the jent/remove_recovery_failure_lockout branch from 9f8fb88 to c5fbce0 Compare January 10, 2024 18:51
Copy link

🤖 Vercel preview here: https://docs-kxlh7p8g5-goteleport.vercel.app/docs/ver/preview

Copy link

🤖 Vercel preview here: https://docs-aac30f8qy-goteleport.vercel.app/docs/ver/preview

Copy link
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're almost there.

lib/auth/accountrecovery.go Outdated Show resolved Hide resolved
lib/auth/accountrecovery.go Outdated Show resolved Hide resolved
lib/services/identity.go Show resolved Hide resolved
Copy link

🤖 Vercel preview here: https://docs-8oucg7azh-goteleport.vercel.app/docs/ver/preview

@zmb3
Copy link
Collaborator

zmb3 commented Jan 24, 2024

/excludeflake *

@jentfoo jentfoo added this pull request to the merge queue Jan 24, 2024
Merged via the queue into master with commit 09a33d8 Jan 24, 2024
40 checks passed
@jentfoo jentfoo deleted the jent/remove_recovery_failure_lockout branch January 24, 2024 18:37
@public-teleport-github-review-bot

@jentfoo See the table below for backport results.

Branch Result
branch/v15 Failed

jentfoo added a commit that referenced this pull request Jan 24, 2024
* Remove account lockout from failed recovery attempts

This account lockout looks to be unecessary and potentially problematic.  Recovery codes and recovery through MFA are not possible to brute force.

In addition the potential to lockout an account from being able to use a recovery method could result in them being unable to unlock their account from other potential abuse cases (for example an attacker locking the account from failed password attempts).

As discussed in the RFD (#35533) this includes the removal of all the API used for this locking mechanism.

* accountrecovery: Update `WithLock` function names

* accountrecovery: Combine verifyRecoveryCode and verifyRecoveryCodeWithRecord into one function
github-merge-queue bot pushed a commit that referenced this pull request Jan 25, 2024
* Remove account lockout from failed recovery attempts

This account lockout looks to be unecessary and potentially problematic.  Recovery codes and recovery through MFA are not possible to brute force.

In addition the potential to lockout an account from being able to use a recovery method could result in them being unable to unlock their account from other potential abuse cases (for example an attacker locking the account from failed password attempts).

As discussed in the RFD (#35533) this includes the removal of all the API used for this locking mechanism.

* accountrecovery: Update `WithLock` function names

* accountrecovery: Combine verifyRecoveryCode and verifyRecoveryCodeWithRecord into one function
Comment on lines +3279 to +3280
reserved 5; // removed "google.protobuf.Timestamp RecoveryAttemptLockExpires" after lockout was removed
reserved "RecoveryAttemptLockExpires";
Copy link
Contributor

@codingllama codingllama Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of this field is making UpdateAndSwapUser fail.

If the stored user had the "recovery_attempt_lock_expires" field set, then the comparison always fails. That is because when we read and unmarshal the user the unknown field gets dropped, but the actual CompareAndSwap operation compares using the storage blobs instead.

Reverting the deletion, but keeping the field deprecated should serve as an immediate fix. Arguably, a better fix is to make sure CompareAndSwap compare apples-to-apples: either user vs user, or blob vs blob, but never user vs blob.

@jentfoo @rosstimothy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just submitted a PR to bring the field back: #37618

Thank you for finding this issue @codingllama!

zmb3 added a commit that referenced this pull request May 6, 2024
Also removes the outdated mention of locking accounts after failed
password reset attempts. This functionality was removed in #35325
but the docs were not updated.

Closes #41135
zmb3 added a commit that referenced this pull request May 7, 2024
Also removes the outdated mention of locking accounts after failed
password reset attempts. This functionality was removed in #35325
but the docs were not updated.

Closes #41135
github-merge-queue bot pushed a commit that referenced this pull request May 7, 2024
Also removes the outdated mention of locking accounts after failed
password reset attempts. This functionality was removed in #35325
but the docs were not updated.

Closes #41135
github-actions bot pushed a commit that referenced this pull request May 7, 2024
Also removes the outdated mention of locking accounts after failed
password reset attempts. This functionality was removed in #35325
but the docs were not updated.

Closes #41135
github-merge-queue bot pushed a commit that referenced this pull request May 8, 2024
Also removes the outdated mention of locking accounts after failed
password reset attempts. This functionality was removed in #35325
but the docs were not updated.

Closes #41135

Co-authored-by: Steven Martin <steven@goteleport.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v15 no-changelog Indicates that a PR does not require a changelog entry rfd Request for Discussion size/sm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants