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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify state before using errors received from provider #144

Merged
merged 1 commit into from Nov 2, 2021
Merged

Verify state before using errors received from provider #144

merged 1 commit into from Nov 2, 2021

Conversation

toupeira
Copy link
Member

@toupeira toupeira commented Nov 2, 2021

Summary

This avoids content spoofing attacks by crafting a URL with malicious messages, because the state param is only present in the session after a valid OAuth2 authentication flow.

Background

This vulnerability was reported to GitLab in https://gitlab.com/gitlab-org/gitlab/-/issues/27241 and patched for the 14.3.1 security release in https://gitlab.com/gitlab-org/gitlab/-/commit/79457dafe55. We haven't encountered any problems with this change in our testing and usage.

An example URL to exploit this is https://gitlab.com/users/auth/bitbucket/callback?state=cae8687aa809fc45e00b2f8ed4a0ea124d5f9b8235cb2b2e&error_description=YOUR+ACCOUNT+WAS+LOCKED,PLEASE+GO+TO+https://evil.com+FOR+UNLOCKING+YOUR+ACCOUNT&error=access_denied, previously this would render the attacker's URL in the flash message (which IIRC is the default behaviour when using OmniAuth with Devise), but after this change we'll get the CSRF error instead.

The vulnerability is pretty minor overall, but the fix is also simple so I think this would be worth upstreaming 馃榾

This avoids content spoofing attacks by crafting a URL with malicious
messages, because the `state` param is only present in the session after
a valid OAuth2 authentication flow.
@BobbyMcWho
Copy link
Member

Thanks for the PR Markus, I appreciate the upstream fix. As soon as I have a moment, I will review the PR.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1413410154

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+2.2%) to 84.615%

Totals Coverage Status
Change from base Build 500123692: 2.2%
Covered Lines: 77
Relevant Lines: 91

馃挍 - Coveralls

@BobbyMcWho BobbyMcWho merged commit 561ddce into omniauth:master Nov 2, 2021
@toupeira toupeira deleted the verify-state-before-using-provider-errors branch November 3, 2021 13:26
@toupeira
Copy link
Member Author

toupeira commented Nov 3, 2021

@BobbyMcWho thanks for the quick review! 鉂わ笍

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

Successfully merging this pull request may close these issues.

None yet

3 participants