The vulnerability is a stored Cross-Site Scripting (XSS) issue in Liferay Portal, originating from the handling of Dynamic Data Mapping (DDM) structure field labels. The analysis of the provided patches pinpoints the exact locations in the backend code where the vulnerability was addressed.
The root cause is the failure to sanitize user-provided labels for DDM structure fields. An attacker can create a data structure with a field label containing malicious JavaScript. When this structure is processed by the system, the script is stored.
The investigation of the commits reveals two key vulnerable functions:
-
com.liferay.asset.model.DDMStructureClassType.getClassTypeFields: This method is responsible for reading the DDM structure definitions. The patch c07a490b3d3759f38c5473cda74e99540bd0235e clearly shows that the label was being read directly and was later escaped using HtmlUtil.escape(). This indicates that this function was a source of unsanitized data, creating ClassTypeField objects with potentially malicious labels.
-
com.liferay.journal.internal.util.JournalDefaultTemplateProviderImpl._addDDMStructureFields: This method consumes the data from DDM structures to generate default template content. The same patch shows that it was appending the raw label to an HTML string (StringBuilder). This is a sink for the vulnerability, where the unsanitized data is used to construct a web page, leading to XSS when the page is rendered in a user's browser. The fix involves escaping the label before it's appended.
The vulnerability description mentions the Source.js module in the Asset Publisher configuration UI, which is the client-side component. The identified Java functions are the server-side source of the vulnerable data that is sent to this JavaScript module. By fixing the issue on the backend, the malicious script is neutralized before it can reach the client-side code, thus preventing the innerHTML injection described.