The vulnerability is a reflected Cross-Site Scripting (XSS) issue on the Apache Syncope Enduser login page. An attacker can craft a malicious URL containing a JavaScript payload in a parameter that is used as a notification message on the login page. When a legitimate user clicks this link and attempts to log in, the malicious script is executed in their browser, potentially leading to credential theft.
The analysis of the patches between the vulnerable and fixed versions revealed the exact location of the vulnerability. The commit with the message 'Enduser: ensure to sanitize notification message' (fb0e1bff2e1101ba23d31f1ee0abfed54278570c for version 3.0.16 and fed74c132e940b52936468658145e5eda149878c for version 4.0.4) clearly shows the fix.
The patch introduces the use of StringEscapeUtils.escapeEcmaScript from the org.apache.commons:commons-text library to sanitize the notificationMessage in the org.apache.syncope.client.ui.commons.BaseLogin.renderHead method. This prevents the injection of malicious scripts.
The vulnerable function org.apache.syncope.client.ui.commons.BaseLogin.renderHead was identified as it is the entry point where the unsanitized user input is processed. The function org.apache.syncope.client.ui.commons.StyledNotificationBehavior.jQueryShow was also identified as it is the function that constructs the JavaScript code with the unsanitized input, making it a critical part of the exploitation chain.