Cookies
Every cookie XWiki core sets, with what it holds, where it is scoped, how long it lasts and whether it is restricted to HTTPS.
Reference
XWiki stores a handful of cookies on the reader's machine. Most of them only remember a preference, but four of them sign a returning reader back in without a new login, which is what makes the set worth an attacker's attention.
The table below is the list for XWiki core. An installed extension may set cookies of its own, and documents them on its own page.
The four authentication cookies are named after xwiki.authentication.cookieprefix, which is empty unless you set it. That property and every other one named below live in xwiki.cfg and are described in Authentication Parameters.
| Cookie | Content | Path | Domain | Max age | Secure | HTTP only | Purpose |
|---|---|---|---|---|---|---|---|
| JSESSIONID | The HTTP session identifier. | The web application's context path, /xwiki by default | The server name | The session, which the Servlet Container times out after 30 minutes under Tomcat's defaults | Only over HTTPS, and only where the container sets the flag | Depends on the Servlet Container | Created by the Servlet Container rather than by XWiki |
| ckCsrfToken | A 40-character random token. | / | The server name | The session | No | No, because it is written from JavaScript | Created by CKEditor for its own uploads. XWiki never reads it and protects its own forms with the CSRF token mechanism |
| language | The locale the reader chose. | / | None | 10 years | No | No | Remembers the chosen locale, and is only set on a multilingual wiki |
| visitid | A random 32-character alphanumeric value. | / | The entry of xwiki.authentication.cookiedomains matching the server name, none when none matches | A fixed date, 31 December 2029 | No | No | Recognizes a returning visitor for the statistics module, whose storage is off by default |
| [xwiki.authentication.cookieprefix]username | The encrypted user name. | xwiki.authentication.cookiepath, / by default | The entry of xwiki.authentication.cookiedomains matching the server name, none when none matches | xwiki.authentication.cookielife days, 15 by default, or the browser session when "Remember me" was not ticked | Only over HTTPS | Yes | Signs a returning reader back in without a new login |
| [xwiki.authentication.cookieprefix]password | The encrypted password. | xwiki.authentication.cookiepath, / by default | The entry of xwiki.authentication.cookiedomains matching the server name, none when none matches | xwiki.authentication.cookielife days, 15 by default, or the browser session when "Remember me" was not ticked | Only over HTTPS | Yes | Signs a returning reader back in without a new login |
| [xwiki.authentication.cookieprefix]rememberme | true when "Remember me" was ticked, false otherwise. | xwiki.authentication.cookiepath, / by default | The entry of xwiki.authentication.cookiedomains matching the server name, none when none matches | xwiki.authentication.cookielife days, 15 by default, or the browser session when "Remember me" was not ticked | Only over HTTPS | Yes | Signs a returning reader back in without a new login |
| [xwiki.authentication.cookieprefix]validation | An MD5 hash over the two encrypted values above, the client IP address when xwiki.authentication.useip is on, and xwiki.authentication.validationKey. | xwiki.authentication.cookiepath, / by default | The entry of xwiki.authentication.cookiedomains matching the server name, none when none matches | xwiki.authentication.cookielife days, 15 by default, or the browser session when "Remember me" was not ticked | Only over HTTPS | Yes | Signs a returning reader back in without a new login |
Secure means the browser only sends the cookie over HTTPS. HTTP only means a script running in the page cannot read it.
Three of those cookies carry the credentials themselves: the user name, the password and a validation hash over both. All three are encrypted before they are stored, so an attacker who obtains them still cannot read the account's user name and password.
Encryption stops an attacker reading a stolen cookie. It does not stop them replaying it. XWiki therefore binds each authentication cookie to the IP address that obtained it and refuses it from any other, which xwiki.authentication.useip turns off for the networks where a reader's address legitimately changes. How a cookie gets stolen in the first place is covered in Attack Vectors.
FAQ
Can XWiki run without setting cookies?
No. The session cookie belongs to the Servlet Container and the wiki cannot work without a session. The four authentication cookies are different: they are only stored when a reader ticks "Remember me", so a wiki whose readers never tick it keeps nothing beyond the session.
Why is ckCsrfToken neither secure nor HTTP only?
CKEditor writes it from JavaScript and reads it back the same way, so neither flag can be set on it. It carries no credential, and XWiki does not use it for anything.