-
Notifications
You must be signed in to change notification settings - Fork 49
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
ZCS-12917: Fix "An unknown error has occurred" raised when zimbraMailURL is configured #791
base: develop
Are you sure you want to change the base?
Conversation
Micro-Learning Topic: Cross-site request forgery (Detected by phrase)Matched on "CSRF"Session-related but not session-based, this attack is based on the ability of an attacker to force an action on a user’s browser (commonly in the form of a POST request) to perform an unauthorized action on behalf of the user. This can often occur without the user even noticing it… or only noticing when it is too late. The root cause is that browsers automatically send session cookies with all requests to a given domain, regardless of where the source of the request came from, and the application server cannot differentiate between a request that came from pages it served or a request that came from an unrelated page. Try a challenge in Secure Code WarriorHelpful references
|
I found that ZM_LOGIN_CSRF cookie was not removed after login at line 154-156. I will fix it and update the PR. |
I added a commit. |
Issue:
When zimbraMailURL is changed from
/
to/test/path
, for example, and user accesseshttps://host/
(without the path), login fails with an error "An unknown error has occurred."Steps:
/test/path
https://host/
https://host/test/path/?client=advanced
https://host/test/path/?loginOp=logout
https://host/
without the pathEasier way:
/test/path
https://host/test/path
https://host/
Root cause:
When login page accessed,
ZM_LOGIN_CSRF
is created on a browser. The path of the cookie depends on the access URL.https://host
-> the path of the cookie is/
https://host/test/path
-> the path of the cookie is/test/path
When a browser has the both cookies, login from
https://host
fails because(param.login_csrf eq cookie.ZM_LOGIN_CSRF.value)
returnsfalse
.cookie.ZM_LOGIN_CSRF
refers a cookie for/test/path
, not for/
. Then it falls back toc:otherwise
block.Fix:
/
explicitly for ZM_LOGIN_CSRF and ZM_TEST cookies