CVE-2023-40176: SXSS in the user profile via the timezone displayer
Impact
Any registered user can exploit a stored XSS through their user profile by setting the payload as the value of the time zone user preference. Even though the time zone is selected from a drop down (no free text value) it can still be set from JavaScript (using the browser developer tools) or by calling the save URL on the user profile with the right query string. Once the time zone is set it is displayed without escaping which means the payload gets executed for any user that visits the malicious user profile, allowing the attacker to steal information and even gain more access rights (escalation to programming rights).
The problem is present since version 4.1M2 when the time zone user preference was introduced.
Patches
The issue has been fixed in XWiki 14.10.5 and 15.1RC1 by https://github.com/xwiki/xwiki-platform/commit/d11ca5d781f8a42a85bc98eb82306c1431e764d4 . The main fix is in the displayertimezone.vm precisely at this line:
$!escapetool.xml($value)
By escaping the displayed time zone value we make sure the attacker's payload is not executed.
Workarounds
If you want to fix this problem on older versions of XWiki that have not been patched then you need to edit displayertimezone.vm and escape the displayed time zone value here:
- $!value + $!escapetool.xml($value)
References
JIRA issue https://jira.xwiki.org/browse/XWIKI-20276 Fix https://github.com/xwiki/xwiki-platform/commit/d11ca5d781f8a42a85bc98eb82306c1431e764d4
For more information
If you have any questions or comments about this advisory: Open an issue in Jira XWiki.org Email us at Security Mailing List
Attribution
This vulnerability has been found and reported by @michitux .
Other sources
XWiki Platform is a generic wiki platform offering runtime services for applications built on top of it. Any registered user can exploit a stored XSS through their user profile by setting the payload as the value of the time zone user preference. Even though the time zone is selected from a drop down (no free text value) it can still be set from JavaScript (using the browser developer tools) or by calling the save URL on the user profile with the right query string. Once the time zone is set it is displayed without escaping which means the payload gets executed for any user that visits the malicious user profile, allowing the attacker to steal information and even gain more access rights (escalation to programming rights). This issue is present since version 4.1M2 when the time zone user preference was introduced. The issue has been fixed in XWiki 14.10.5 and 15.1RC1.
Affected Software
Remediation
Event History
Frequently Asked Questions
What is CVE-2023-40176?
CVE-2023-40176 is a vulnerability in XWiki Platform that allows any registered user to exploit a stored XSS through their user profile by setting the payload as the value of the time zone user preference.
What is the impact of CVE-2023-40176?
The impact of CVE-2023-40176 is that it allows an attacker to execute malicious code within the context of the affected user's browser, potentially leading to unauthorized actions or data theft.
How can an attacker exploit CVE-2023-40176?
An attacker can exploit CVE-2023-40176 by setting the payload as the value of the time zone user preference in their user profile, which will be executed when the affected user views their profile page.
What is the severity of CVE-2023-40176?
CVE-2023-40176 has a severity rating of 5.4 (Moderate).
How do I fix CVE-2023-40176?
To fix CVE-2023-40176, it is recommended to upgrade to XWiki Platform version 14.10.5 or later.