-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add mitigation against BREACH #18254
Conversation
@@ -1057,7 +1057,7 @@ public static function getInstanceId() { | |||
/** | |||
* Register an get/post call. Important to prevent CSRF attacks. | |||
* | |||
* @return string Generated token. | |||
* @return string XOR'd CSRF token with an appended random separated by `:` |
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.
/XOR/encrypted/
d17ed9d
to
e51d717
Compare
sigh |
@@ -415,8 +421,25 @@ public function passesCSRFCheck() { | |||
return false; | |||
} | |||
|
|||
if(is_null($this->crypto)) { |
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.
Remove this and the null default?
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.
Fixed. Needed some small change to base.php though since autoloading is not available at this stuff and cyclic dependency fun…
e51d717
to
89b78bc
Compare
While BREACH requires the following three factors to be effectively exploitable we should add another mitigation: 1. Application must support HTTP compression 2. Response most reflect user-controlled input 3. Response should contain sensitive data Especially part 2 is with ownCloud not really given since user-input is usually only echoed if a CSRF token has been passed. To reduce the risk even further it is however sensible to encrypt the CSRF token with a shared secret. Since this will change on every request an attack such as BREACH is not feasible anymore against the CSRF token at least.
89b78bc
to
df2ce8a
Compare
A new inspection was created. |
Let's try again before creating a new branch. |
Reviews? 🙊 To test this basically take a look at the HTML source of ownCloud and check if the requesttoken is different each reload. Besides that click around and check if there are no CSRF token fails ;) |
This wants reviewers lalalalalala – just 👍'ing is also fine 🙊 |
looks good 👍 |
Did some tests - works 👍 |
Add mitigation against BREACH
While BREACH requires the following three factors to be effectively exploitable we should add another mitigation:
Especially part 2 is with ownCloud not really given since user-input is usually only echoed if a CSRF token has been passed. (though there are parts such as the search box…)
To reduce the risk even further it is however sensible to encrypt the CSRF token with a shared secret. Since this will change on every request an attack such as BREACH is not feasible anymore against the CSRF token at least.
cc @owncloud/security-team Care to review?