The vulnerability, CVE-2025-43766, allows for unrestricted file uploads in the Liferay Portal's style books component, which can lead to arbitrary code execution. The analysis of the provided patch commit d4a5b8fc9f88468168603ff8a1f9b81fa5b7c43e reveals the exact location of the vulnerability.
The core of the issue lies within the UpdateStyleBookEntryPreviewMVCActionCommand.java file. The doProcessAction method in this class is responsible for handling the file upload for style book previews. The diff shows that prior to the patch, the code did not perform any validation on the uploaded file's extension or MIME type. It would accept any file, which an attacker could exploit by uploading a malicious script (e.g., a JSP file).
The patch rectifies this by introducing two key changes:
-
Backend Validation: In UpdateStyleBookEntryPreviewMVCActionCommand.doProcessAction, a check is added to validate the file extension against a whitelist of image formats (.bmp, .jpeg, .jpg, .png, .tiff) and to ensure the MIME type starts with image/. If the file is invalid, an error is flagged and the upload is rejected.
-
Frontend Restriction: In StyleBookEntryActionDropdownItemsProvider.java, the file upload component is now configured to only allow the selection of files with the whitelisted image extensions. This is a client-side mitigation that improves user experience and provides an initial layer of defense.
Based on this evidence, the primary vulnerable function is com.liferay.style.book.web.internal.portlet.action.UpdateStyleBookEntryPreviewMVCActionCommand.doProcessAction, as it contained the flawed logic that permitted the unrestricted file upload on the server side.