-
Notifications
You must be signed in to change notification settings - Fork 9.4k
fix: file validation bypass by targeting non file input types during customer file upload #40262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.4-develop
Are you sure you want to change the base?
Conversation
|
Hi @SamJUK. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
|
The security team has been informed about this pull request due to the presence of risky security keywords. For security vulnerability reports, please visit Adobe's vulnerability disclosure program on HackerOne or email [email protected]. |
|
@magento run all tests |
|
Pull Requests are not mergeable to the mainline. Please merge the latest mainlines to your Pull Requests and restart the builds. |
|
@magento run all tests |
|
Excellent work @SamJUK! I've got a nearly identical PR locally 😂 |
|
Our Virus security alerted us tonight about malware being uploaded to our Magento 2.4.8-p3 patched store. Here's the file that was uploaded. I have since made a rule to block the path. |
|
@magento create issue |
|
The security team has been informed about this pull request due to the presence of risky security keywords. For security vulnerability reports, please visit Adobe's vulnerability disclosure program on HackerOne or email [email protected]. |
Description (*)
Currently, we can upload files against any attribute types via the customer file upload controllers.
This is not ideal as, we can target non file based types (Select/Hidden/Text) to bypass the expected validation logic that would take place for a Image/File type.
And as far as I am aware, there is no valid reason to be uploading a file, to non file input types (e.g select / text).
This specific functionality is actively being exploited as part of the Session Reaper (CVE-2025-54236) chain to achieve RCE.
https://slcyber.io/assetnote-security-research-center/why-nested-deserialization-is-still-harmful-magento-rce-cve-2025-54236/
This PR restricts the file uploads to only input types that are expected to have file uploads. Whilst leaving the input types configurable to merchants/extension developers via di.xml
Manual testing scenarios (*)
Checkout 2.4-develop
Post an arbitrary file to the
customer/address_file/uploadendpoint, targeting a select attribute (country_id)Note a success message, and the file is present in the
pub/media/customer_addressdirectoryPost an arbitrary file to the
customer/address_file/uploadendpoint, targeting a text attribute (city)Note a error message, referencing text based validation error trying to validate a file as a string
Checkout this PR
Repeat Steps 2 & 3, note a friendly error message stating file uploads are unexpected.
Create a image/file based attribute, update the curl command to target that. Upload should succeed.
Contribution checklist (*)
Resolved issues: