Wiki source code of Hide the XWiki Version

Last modified by Eleni Cojocariu on 2026/12/04 16:09

Hide last authors
Eleni Cojocariu 4.1 1 Every page of a wiki prints the exact XWiki version in its footer, which hands any reader a shortlist of published vulnerabilities to try against the instance, one of the openings [[Attack Vectors>>doc:documentation.xs.admin.security.attack-vectors.WebHome]] describes.
2
3 {{info}}
4 Nothing below makes the version unobtainable. Every page loads scripts and stylesheets from addresses that carry the version of the extension they belong to, and for the extensions XWiki bundles that is the XWiki version; anyone can read them in the page source, and neither step changes them. What follows removes the version from the two places that state it outright. Keeping the instance upgraded is what removes the vulnerabilities.
5 {{/info}}
6
7 1. Change what the footer shows. Open the drawer, choose "Administer Wiki", then the "Look & Feel" category and its "Presentation" section. Fill the "Version" field, under "Footer", with the text you want in place of the version, and save.(((
8 {{image reference="version-field.png" size="large" alt="The Footer group of the Presentation administration section, its Version field filled with a custom string"/}}
9
10 The field exists in the wiki administration only, and the text replaces the whole footer entry: the product name and its link to the [[Administration Application>>doc:extensions:Extension.Administration Application]] disappear with the version, which matters because the address behind that link carries the version too.
11 )))
12 1. Stop the wiki from reporting the version itself, if a tidy footer is not what you are after. The field above changes nothing else, and the REST API answers any caller, signed in or not, with the real version. Create a ##version.properties## file in the ##WEB-INF## directory of the deployed web application, holding one line.(((
13 {{code language="properties"}}
14 version=Intranet Wiki
15 {{/code}}
16
17 Redeploying the web application removes the file again, so add it to whatever provisions the deployment. Restart the Servlet Container for the new value to be read.
18
19 {{warning}}
20 XWiki reads this file wherever it reports its own version, so anything that compares the version it is running against another value sees your string rather than a number. Choose one and keep it stable.
21 {{/warning}}
22 )))
23 1. Reload any page and look at the footer, then ask the wiki what it runs.(((
Eleni Cojocariu 7.2 24 {{image reference="custom-version-footer.png" size="extra" alt="The footer of a wiki page showing a custom string where the version used to be"/}}
Eleni Cojocariu 4.1 25
26 {{code language="none"}}
27 curl -s https://wiki.example.org/xwiki/rest/
28 {{/code}}
29
30 The version element of the answer now holds the same string, and so does the ##XWiki-Version## header on every REST response:
31
32 {{code language="none"}}
33 <version>Intranet Wiki</version>
34 {{/code}}
35 )))

Get Connected