CVE-2022-4560 (Java, published 2022-12-16T17:15Z)
Description: value: A vulnerability was found in Joget up to 7.0.31. It has been rated as problematic. This issue affects the function getInternalJsCssLib of the file wflow-core/src/main/java/org/joget/plugin/enterprise/UniversalTheme.java of the component wflow-core. The manipulation of the argument key leads to cross site scripting. The attack may be initiated remotely. Upgrading to version 7.0.32 is able to address this issue. The name of the patch is ecf8be8f6f0cb725c18536ddc726d42a11bdaa1b. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-215963.
Severity: nan (CVSS v3 base score: 6.1)
Weakness: CWE-79 \u2014 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Repository: https://github.com/jogetworkflow/jw-community
Files changed:
wflow-consoleweb/src/main/java/org/joget/apps/app/controller/UserviewWebController.java
wflow-core/src/main/java/org/joget/apps/userview/service/UserviewService.java
wflow-core/src/main/java/org/joget/plugin/enterprise/UniversalTheme.java
Commit message: Fixed: wflow-core - Userview - Fixed XSS issue on key parameter. @7.0-SNAPSHOT

Vulnerable code:
        if (key != null && key.equals(Userview.USERVIEW_KEY_EMPTY_VALUE)) {
                        + "PwaUtil.contextPath = '" + data.get("context_path") + "';"
                        + "PwaUtil.userviewKey = '" + key + "';"
                        + "PwaUtil.homePageLink = '" + data.get("home_page_link") + "';"
                        + "PwaUtil.serviceWorkerPath = '" + serviceWorkerUrl + "';"
                        + "PwaUtil.subscriptionApiPath = '" + data.get("context_path") + "/web/console/profile/subscription';"
                        + "PwaUtil.currentUsername = '" + workflowUserManager.getCurrentUsername() + "';"
                        + "PwaUtil.onlineNotificationMessage = '" + pwaOnlineNotificationMessage + "';"
                        + "PwaUtil.offlineNotificationMessage = '" + pwaOfflineNotificationMessage + "';"
                        + "PwaUtil.loginPromptMessage = '" + pwaLoginPromptMessage + "';"
                        + "PwaUtil.syncingMessage = '" + pwaSyncingMessage + "';"
                        + "PwaUtil.syncFailedMessage = '" + pwaSyncFailedMessage + "';"
                        + "PwaUtil.syncSuccessMessage = '" + pwaSyncSuccessMessage + "';"

Fixed code:
        if (key == null || (key != null && key.equals(Userview.USERVIEW_KEY_EMPTY_VALUE))) {
        requestParameters.put("key", (key != null)?key:"");
                        + "PwaUtil.contextPath = '" + StringUtil.escapeString(data.get("context_path").toString(), StringUtil.TYPE_JAVASCIPT, null) + "';"
                        + "PwaUtil.userviewKey = '" + StringUtil.escapeString(key, StringUtil.TYPE_JAVASCIPT, null) + "';"
                        + "PwaUtil.homePageLink = '" + StringUtil.escapeString(data.get("home_page_link").toString(), StringUtil.TYPE_JAVASCIPT, null) + "';"
                        + "PwaUtil.serviceWorkerPath = '" + StringUtil.escapeString(serviceWorkerUrl, StringUtil.TYPE_JAVASCIPT, null) + "';"
                        + "PwaUtil.subscriptionApiPath = '" + StringUtil.escapeString(data.get("context_path").toString(), StringUtil.TYPE_JAVASCIPT, null) + "/web/console/profile/subscription';"
                        + "PwaUtil.currentUsername = '" + StringUtil.escapeString(workflowUserManager.getCurrentUsername(), StringUtil.TYPE_JAVASCIPT, null) + "';"
                        + "PwaUtil.onlineNotificationMessage = '" + StringUtil.escapeString(pwaOnlineNotificationMessage, StringUtil.TYPE_JAVASCIPT, null) + "';"
                        + "PwaUtil.offlineNotificationMessage = '" + StringUtil.escapeString(pwaOfflineNotificationMessage, StringUtil.TYPE_JAVASCIPT, null) + "';"
                        + "PwaUtil.loginPromptMessage = '" + StringUtil.escapeString(pwaLoginPromptMessage, StringUtil.TYPE_JAVASCIPT, null) + "';"
                        + "PwaUtil.syncingMessage = '" + StringUtil.escapeString(pwaSyncingMessage, StringUtil.TYPE_JAVASCIPT, null) + "';"
                        + "PwaUtil.syncFailedMessage = '" + StringUtil.escapeString(pwaSyncFailedMessage, StringUtil.TYPE_JAVA, null) + "';"
                        + "PwaUtil.syncSuccessMessage = '" + StringUtil.escapeString(pwaSyncSuccessMessage, StringUtil.TYPE_JAVASCIPT, null) + "';"