-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Disable the cookie check when authorization headers are send. #3361
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
Conversation
Signed-off-by: brantje <brantje@gmail.com>
skjnldsv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with this. 👍
@nextcloud/security ?
LukasReschke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has a negative security impact. Please explain more detailed what problem you're facing at the moment and then we can take a closer look.
|
That's what I was afraid of :/ |
The problem occurs when a user is logged into the nextcloud instance. Extension source: -removed- The request the build here: https://git.passman.cc/passman/passman-webextension/blob/master/js/lib/api.js#L123 |
Codecov Report@@ Coverage Diff @@
## master #3361 +/- ##
============================================
- Coverage 53.99% 53.99% -0.01%
- Complexity 0 21009 +21009
============================================
Files 1303 1303
Lines 80377 80377
Branches 1253 1253
============================================
- Hits 43397 43396 -1
- Misses 36980 36981 +1
Continue to review full report at Codecov.
|
|
Another side effect of placing cookies when a request is made with Authorization headers is that they are instantly logged into the Nextcloud instance with the credentials they supplied in the Authorization header. So if i logout of nextcloud, make a request with the extension (with auth headers), then i'm back logged into nextcloud. |
|
I also agree that if you are using basic auth method cookies make no sense at all. |
|
@LukasReschke Can you update us? We really want to release the extension.... |
|
Is there any update on the issue? What kind of negative security impact are you talking about @LukasReschke? |
This basically allows bypassing the Same-Site cookie check completely.
This does not really encourage me to dig into this pull request 😉 – Please post at least a minimum working example of your code so that I can see what you are in detail doing here. |
|
At the moment source is private until we solve this. Code for making the api request is here: https://gist.github.com/brantje/d7ef651807204c830a1c2bfcd7164359 |
Then please provide a minimum working example of JS code that showcases the problem. The JS code you've pasted is not what I'd consider minimal example. (e.g. not something that I can easily paste in my browser console and have it do something) |
|
Signup on https://git.passman.cc and i will give you access to the repo. |
|
Just found a new problem. Looks like an account take over, because nextcloud sets cookies when HTTP_AUTH is used. |
This is the expected behaviour as otherwise the sync clients would need to do an reauthentication action on every attempt which is not really performant and also may result in external network calls. (e.g. LDAP / …) I don't really see any issue here. Quite frankly, Basic Auth is not the ideal candidate when it comes to authenticating. – Though at the moment it's the primary authentication mechanism but we'll have in the mid- to long-term some more token based authentications in offer. When doing a Basic Auth you'll be issued HTTP cookies and can then either to decide to reuse those or not. If you reuse them it is however also expected that your application is properly consuming cookies. (i.e. resends all of them and not only a subset) If you want more flexibility right now you probably want to write your own SyncControllers that can handle authentication the way you require them to be.
And so is signing up for me on some other service 😉 – Please send it via email then or so… |
|
@brantje this means you could hijack an account? But at the issue as i understand is that if value teturns false it does will execute rest what will result in nothing so it goes back to start so endless loop! |
|
@maestroi Yes, but @LukasReschke pointed out thats 'by design' |
|
@LukasReschke I've mailed the extension source to your nextcloud mail. The issue should be reproducible without passman. |
|
Closing, issue solved. |
I had a really hard time detecting my redirecting errors.
Finally found them, seems that when the extension calls an endpoint (with an Authorization header set) it send the cookies with them, and no way to disable that.
Nextcloud see's the cookie's and does a check on them using
passesLaxCookieCheckandcookieCheckRequired.In my opinion the cookie check is not needed when using an Authorization header, since you already supply the credentials with it.
Really hope that this could get merged fast, since this is the major blocker for releasing the passman extension.