Magento allows unauthenticated file upload that can lead to remote code execution
Any Magento Open Source or Adobe Commerce instance up to version 2.4.9-alpha2 is vulnerable to an unauthenticated unrestricted file upload that can persist arbitrary files and achieve RCE when the web server configuration is lax.
Security & privacy Assetnote / Searchlight 26 Mar 2026 Disclosure Prototype evidence
Published as “Magento PolyShell: Unauthenticated File Upload to RCE (APSB25-94)”
Why it matters
Unauthenticated attackers can achieve persistent code execution on Magento sites that use default or misconfigured web-server settings.
Summary
The researchers identified that Magento's REST API for guest carts accepts file uploads via custom options. By sending a crafted JSON payload they can store a polyglot PHP payload as an image file, which is written to pub/media/custom_options. The file is executable only if the web server or .htaccess configuration is permissive, allowing stored XSS or full RCE. They provide a Python proof-of-concept script and demonstrate the exploit on a test instance. The evidence is limited to a single controlled environment and relies on misconfiguration.
What they found 3
- Magento's REST API accepts file uploads as part of the cart item custom options
“Magento's REST API accepts file uploads as part of the cart item custom options.”
- In the right conditions, the vulnerability leads to unauthenticated remote code execution
“In the right conditions, it results in unauthenticated remote code execution.”
- The uploaded file is only accessible if the web server is misconfigured
“The uploaded file is only accessible if the web server is misconfigured, otherwise attempting to access it will result in a 404.”
Caveats 5
- This doesn't work against every instance.
- The uploaded file is only accessible if the web server is misconfigured, otherwise attempting to access it will result in a 404.
- On our test instance we were able to make the server vulnerable to stored XSS by deleting pub/media/custom_options/.htaccess
- Unfortunately there's no patch for stable version of Magento yet.
- In 2.4.9-alpha3, the new class MagentoCatalogModelProductOptionTypeFileImageContentProcessor has been introduced.
What’s new here 4
- Unauthenticated attackers can upload arbitrary files through the guest-cart REST endpoint.
- The upload bypasses image validation by using polyglot GIF/PNG payloads.
- Exploitation succeeds only when Magento's default .htaccess files are missing or server config is altered.
- Magento 2.4.9-alpha3 introduces a validation class that blocks executable extensions.