The vulnerability is a cross-site scripting (XSS) issue in the workflow process builder of Liferay Portal. The root cause is the improper handling of user-supplied content in workflow definitions. The analysis of the provided patch (commit 3acad2d8683688ce022abf2dfbab9fb500c5a619) reveals two key areas where the vulnerability existed:
-
File Upload Handling: In SourceBuilder.js, the SourceBuilder component, which is responsible for building the workflow definition, had a file upload feature. The content of the uploaded file was read and directly set into the editor without any sanitization. The vulnerable line currentEditor.setData(event.target.result) was replaced with code that sanitizes the input by removing alert() calls. This indicates that any malicious JavaScript in the uploaded file would have been rendered, leading to XSS.
-
XML Validation: In xmlUtil.js, the XMLUtil.validate function was used to validate the workflow definition's XML content. The original implementation only checked if the XML was well-formed. It did not check for malicious attributes that could lead to XSS, such as onerror, innerHTML, src, or url. The patch added explicit checks for these malicious patterns. This lack of validation allowed an attacker to craft a workflow definition with embedded scripts that would be executed by the browser.
Therefore, an authenticated attacker could exploit this vulnerability by creating a workflow definition containing malicious JavaScript. When this definition is viewed or edited by another user, the script would execute in their browser, leading to a persistent XSS attack.