Legacy Knowledge Base
Published Jun. 30, 2025

Liferay Form guest user file upload does not check the mime type

Written By

Ahmed Abdin

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

Issue

  • I would like to report a security issue. If a guest user is allowed to upload files using the Liferay Form, they can upload files with malicious data that can harm the site.

Reproduction Steps:

1. Start 2024.q3.13
2. Go to Content and Data --> Forms and add a form with the following configuration:
a. Add an upload field
b. Enable "Allow Guest Users to Send Files" from the right panel.
c. Save and publish the form
3. Edit the Home page, add a Form widget, configure it to display the created Form, and publish the page.
4. Log out of the page and as a Guest try to upload a Groovy script file file: test-groovy.groovy
Checkpoint: It will not be uploaded. This is expected.
5. Change the file extension from groovy to jpg and try to upload it.
Actual Result: The file is uploaded, even though the content of the file is not an image.
Expected Result: The file should not be uploaded.

Environment

  • Liferay Quarterly Release 2024.q3.13

Resolution

  • The case is fixed by LPD-49016. Please request a hotfix. The fix works by applying the allowed Mime Type at the Control Panel --> Configuration --> Instance Settings --> Documents and Media
Did this article resolve your issue ?

Legacy Knowledge Base