-
-
Notifications
You must be signed in to change notification settings - Fork 984
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
Protect request phase against CSRF when Rails is used. #809
Conversation
Thanks for this patch. Normally, I’d merge and release a security patch immediately but I’m reluctant to do so in this case for two reasons:
I’d propose that we solve this by creating a new gem: I’d like to get 👍 from the original author of OmniAuth (@mbleigh) before making this change as well as the Rails security team (@tenderlove, @jeremy, @NZKoz). If everyone agrees this is a good idea, we can move forward with this plan very quickly. |
@sferik Moving to |
@DouweM That should be doable. Ping: @josevalim and @carlosantoniodasilva. |
Two more questions:
|
|
@DouweM I think it would be helpful to have a CVE-ID for this vulnerability, so we can reference it unambiguously. Since you are most familiar with this issue, could you please initiate that process? The process to request a CVE-ID is described here. |
@sferik Thanks, I'll go through the motions. |
A CVE request has been submitted to the oss-security mailing list: http://www.openwall.com/lists/oss-security/2015/05/26/11 |
I guess I don't understand how this is a Rails specific issue. Any framework you use with Omniauth will have this problem if you're using GET requests (though this solution is for Rails apps). This patch seems fine for handling the Rails side (though I thought we'd do everything automatically if you did a |
@tenderlove I think this issue is not Rails specific so we don't need to handle it, @sferik only want our review in his plan. The plan looks good. The Rails team can help to spread the word via our twitter account and the security list. |
Gothcha. It seems good to me. The only question I have is since the link is turned in to a form, wouldn't we already take care of CSRF validation? I don't know omniauth internals. I assume it's a middleware? If Omiauth was placed after we do CSRF checking, couldn't we delete most of the code in this patch? |
OmniAuth intercepts the request at the Rack middleware level, before it gets to the Rails controller and the If Rails had a This patch basically turns |
Makes sense. 👍 from me on this patch. :) |
@sferik So what's the next step? If you create an |
@tenderlove @rafaelfranca Thanks for taking the time to review this patch. @DouweM I just created an empty repo at https://github.com/intridea/omniauth-rails. I’ll initialize that with a gem scaffold now. Feel free to open a pull request against that repo with the same code you’ve placed here. I’ll be busy for the next few hours but will try to push out a release later on this evening. The I’m going to close this pull request. |
@sferik All right. I won't have time tonight, unfortunately, but I'll submit a pull request tomorrow. |
Hi Guys, |
Hey @SymbianSyMoh, thanks for finding this vulnerability and reporting it to us! I hope you don't mind that that I've taken up the task of reporting where relevant and making sure it gets patched. I've credited you here and in the CVE request: http://www.openwall.com/lists/oss-security/2015/05/26/11. |
Thanks @DouweM really appreciate that 👍 |
@DouweM @sferik @tenderlove Should this issue be reported under this responsible disclosure rules: |
@SymbianSyMoh for this case no, it is not related to Ruby or Rails projects. But if you find something on one of these projects, those are the recommended channels. |
Thanks @rafaelfranca Appreciate it |
Pull request agains omniauth-rails submitted: omniauth/omniauth-rails#1 |
Hi Guys, I know this is a long time ago thread, but guess what? I never _Mohamed Abdelbaset Elnoby_Guru Programmer, Senior Information Security Contact me at: On Wed, May 27, 2015 at 3:35 AM, Douwe Maan [email protected]
|
Hi, I found that README is updated recently.
In the wiki page, EDIT: @DouweM, update the OP with those information if you please. BTW, depedabot may urge to update omniauth to 1.9.1, but I don't think the update don't include any fix for the vulnerability. See v1.9.0...v1.9.1 |
@hiroshi this is correct, unfortunately a resolution for that CVE was not included in that version bump. I am not sure of any time-frame in which it will be resolved at this point in time. |
What's the status on this one? |
This reverts commit 2dcd499. The CVE hasn't actually been fixed yet.. omniauth/omniauth#809
We need to make sure that we're mitigating the Cross Site Scripting Forgery vulnerability by using a POST method to initiate the Omniauth flow. For more info: https://github.com/omniauth/omniauth/wiki/Resolving-CVE-2015-9284 omniauth/omniauth#809
At this point, is there any reason we can't:
This would solve the issue for (presumably) the majority of us, would be a step in the right direction since the rails solution is more or less figured out and would open the door to other frameworks to contribute an acceptable solution for them. There's already good work done above for sinatra and rack apps. They just need to be finalized. I realize this isn't ideal, but it wouldn't outright break non-rails apps since the We've had some time to let the dust settle, and now I fear that this lingering CVE is conditionalizing everyone to accept that "open CVEs for omniauth" are quite alright. |
Résolution en suivant les points https://github.com/omniauth/omniauth/wiki/Resolving-CVE-2015-9284 ajout du test proposé omniauth/omniauth#809 (comment)
* fix security alert Résolution en suivant les points https://github.com/omniauth/omniauth/wiki/Resolving-CVE-2015-9284 ajout du test proposé omniauth/omniauth#809 (comment) * ajoute une page pour la connexion github en post
I'm trying to take this vulnerability seriously, but I just can't help but think how difficult it would be for an attacker to exploit it in the way described by the OP.
Is there an angle that I'm missing? Or is the main pain of this vulnerability the fact that it has a CVE assigned that is causing noise? I'm currently building OmniAuth integation for Rodauth, and I thought I should go ahead and disallow |
I want to say the fact that we don't persist query params from the callback phase isn't due to the POST method, but the fact that we set the OmniAuth.config.before_callback_phase = ->(env) { env['rack.session']['my.params'] = Rack::Request.new(env).GET.slice("keys", "you", "want") } |
@BobbyMcWho |
I'm open for comments/review on this PR: #1010 |
This comment has been minimized.
This comment has been minimized.
If this is a specific question about the PR I posted, please ask it on the PR #1010 itself. If this is a general OmniAuth question, please refrain from asking in this thread since there are so many people subscribed to it. CVE-2015-9284 questions/concerns should be posted here: #960 |
I've opened a discussion on a v2.0.0 release candidate: #1017 |
The vulnerable by default configuration has been removed in the v2.0.0 release |
TL;DR, as of 2020-03-07:
Original issue description:
The request phase in OmniAuth is currently vulnerable to Cross-Site Request Forgery, which allows an attacker to easily gain full access to a user's account on a site that uses OmniAuth, when used in combination with another CSRF vulnerability on the side of a connected OAuth provider.
This vulnerability was reported to us (GitLab) by Mohamed Abdelbaset Elnoby (@SymbianSyMoh), a Senior Information Security Analyst at Seekurity.com, on April 23rd. On April 24th, we reported it to the OmniAuth team via email. On May 14th, we merged our patch into the public GitLab repository.
Mr. Elnoby also gave us an example of an OAuth provider that had the CSRF vulnerability on their side that is needed to make this attack "weaponizable". The vulnerability has been reported to them.
The below description of the issue is written from GitLab’s perspective.
To actually use the POST method rather than GET so the CSRF token is sent along, we have changed our links to the auth path from:
to:
Note that the current implementation is very specific to Rails. It needs to be, as far as I can see, since the CSRF protection needs to use the web framework’s authenticity token.
I suggest deprecating
OmniAuth.config.allowed_request_methods
and only allowing:post
from now on, but I haven't made that change yet since I think it warrants more discussion.People that use OmniAuth with Rails will need to change the
link_to
helpers and<form>
tags in their own code to usePOST
instead ofGET
,so I’m afraid this is a breaking change and can’t just go in a patch release, in SemVer terms.
cc @sferik