Skip to content
File upload Write-up Intermediate

Magento PolyShell Vulnerability: What Works, What Doesn’t (Ethi

An unrestricted file upload flaw in Magento's REST API allows attackers to upload polyglot files to the server. While remote code execution is possible under specific configurations, the author's testing found it rarely succeeds due to hardened server setups.

Rajesh Mondal Follow

Published on r4j3sh.medium.com

I wanted to share some hands-on findings from my recent testing of the newly disclosed Magento PolyShell vulnerability (APSB25–94). If you’ve been following the security news, you’ve likely seen reports from Sansec, The Hacker News, and Security Affairs about this critical flaw affecting Magento 2 and Adobe Commerce…

Rajesh Mondal, on r4j3sh.medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The REST API accepts base64-encoded file uploads for cart item custom options and writes them to a publicly accessible directory without properly validating or restricting the file type.

Impact

Attackers could upload malicious files that may lead to stored XSS, credential harvesting, or defacement, but remote code execution was not achieved on any tested target due to server hardening.

What the attacker needed

Magento 2 or Adobe Commerce; REST API enabled; Product option of type 'file'

The fix

The vulnerability was fixed in a pre-release branch (2.4.9-alpha3) but no standalone patch has been backported; mitigation involves blocking PHP execution in upload directories and deploying WAF rules.

How it was found

  1. Send a POST request to the customer address file upload endpoint with a crafted file.
  2. The server accepts the file and returns a JSON response containing the file path.
  3. Access the uploaded file via the returned path to verify it is readable.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

This bug lets someone upload a file that looks like an image but contains code. If the server is misconfigured to run that code, an attacker could take over the site. However, most servers are set up to prevent this, so the risk is lower in practice.

What is File upload?

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.

Similar reports

View all

Same bug class and techniques, clearest first.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.