DKDKCISSP
Mass Exploitation — Unauthenticated File Upload

PolyShell: a missing check in Magento's cart API handed attackers a web shell on thousands of stores

Magento and Adobe Commerce let anyone upload a file through the guest cart API and never checked what kind of file it was. A disguised image carrying PHP was enough. Mass scanning started within days of the first warning, and for about two months production stores had no official patch.

First probing
Mar 16, 12:00 UTC
First attacks in the wild
Mar 19
Stores with malicious uploads (Sansec, all stores)
82% by Apr 14
Authentication needed
None (guest cart)
Production patch
Jul 14 for supported lines
Public warning
A day after the flaw was found

Background

Magento Open Source and Adobe Commerce power a large share of online stores. Stores sell through a public REST API, including guest cart routes that need no login, so a shopper can add products to a cart without an account. Cart items can carry custom options, and one option type is a file upload, for example a customer's engraving image.

The flaw sits in how the API handles that file. Security firm Sansec found it, named it PolyShell and tracks it as CVE-2026-48356. Sansec says the vulnerable code has existed since the first Magento 2 release. Sansec sells protection for these stores, so its attack statistics are those of a vendor and should be read that way.

From a guest cart request to a store-wide skimmer

Guest cart request with a disguised imageNo login neededStore writes the file to diskpub/media/custom_options/quote/, no extension checkWeb server runs it as PHPDepends on the hosting configurationBackdoor copies planted in many foldersaccesson.php, to survive clean-upJavaScript loader injected into pagesReaches every visitor to the store
Fig. 1 — Three missing checks, one open endpoint, and a web server setting that decided the outcome.

What actually happened

Magento's REST API accepts a file as part of a cart item's custom options. When an option is of type file, the API reads an embedded block holding base64 file data, a MIME type and a filename, and writes it to pub/media/custom_options/quote/ on the server. Sansec found three missing checks: the submitted option ID was never checked against the product's real options, the file logic ran even when the product had no file option, and no file extension was blocked, so .php, .phtml and .phar all passed. The only test was an image-header check, which a polyglot file (a valid image that also contains code) beats.

The anonymous guest cart routes make it exploitable with no credentials at all. Sansec says GraphQL uses a different code path and is not affected. Whether an uploaded file could actually run depended on the server. Stock Apache and nginx setups differ, many stores use a hosting provider's custom configuration, and Adobe's sample configuration would largely have limited the fallout. Sansec also notes that even where a file cannot run, it stays on disk and could become dangerous after a later configuration change or server move.

Sansec added protection on 16 March 2026 and issued a public warning the next day. First probing was seen from 12:00 UTC on 16 March, the first attacks in the wild on 19 March, and mass automated scanning from 23 March. By 24 March Sansec said 56.7% of all stores had had malicious PHP uploaded, rising to 82% by 14 April. After code execution, attackers planted a backdoor called accesson.php in many folders and injected an obfuscated JavaScript loader into store pages.

Adobe fixed the flaw in the 2.4.9 pre-release branch as part of APSB25-94, and released Magento 2.4.9 on 12 May without backporting the fix to the older supported lines. A backport reached supported release lines on 14 July through APSB26-73. For roughly four months after the first attacks, many production stores had no isolated official patch.

Read the percentages with careSansec reports 79.5% of its protected stores as attacked, then 56.7% and 82% of all stores with uploads, and a figure of 23% for protected stores targeted on 23 March. The denominators differ, and these are the vendor's own figures. They show a very broad campaign, not a precise count of compromised stores.

Root cause

Confirmed
  • Magento's REST API wrote client-supplied files to disk as part of cart item custom options.
  • No validation of the option ID against the product's real options.
  • No gating by option type, so the upload logic ran whether or not the product had a file option.
  • No restriction on file extensions. Only an image-header check, which a polyglot file passes.
  • Guest cart routes need no authentication, which is what turned a bug into mass exploitation.
  • The vulnerable code has been present since the first Magento 2 release, according to Sansec.
  • Adobe fixed it in the 2.4.9 pre-release, released 2.4.9 on 12 May, and backported it on 14 July. For months production stores had no isolated patch.
Reasonable hypothesis — not confirmed
  • Why the flaw went unfound for so long in a heavily reviewed e-commerce platform has not been discussed publicly.
  • How many stores were actually compromised, as opposed to probed or uploaded to, is not known. The percentages are vendor telemetry.
  • A backlog headline linked a Brotli compression issue to this campaign. We could not find that link in Sansec's research and have left it out.

Timeline

Sansec adds PolyShell protection to its Shield service. First probing is recorded at 12:00 UTC the same day.
T1595 · Active Scanning
Sansec publishes the research, names the flaw and issues a public warning.
Attackers upload disguised images carrying PHP through the guest cart API.
T1190 · Exploit Public-Facing ApplicationT1505.003 · Web Shell
Automated scanning starts. By 24 March Sansec says 56.7% of all stores have had malicious PHP uploaded.
Akamai adds PolyShell protection to its WAF. Sansec notes Cloudflare had not published a rule at the time of writing.
A mass wave. Sansec reports accesson.php backdoors and two-stage JavaScript loaders, with attacks on 79.5% of its protected stores.
T1059.007 · JavaScriptT1105 · Ingress Tool Transfer
Adobe ships Magento 2.4.9 with the fix. It is not backported to older supported lines.
Adobe backports the fix to supported release lines through APSB26-73.
Fig. 2 — Hours from first probe to public warning, days to mass scanning, months to a production patch.

Detection

How it was discovered

A security vendor found it. Sansec's forensics team discovered and named the flaw, and its Shield service recorded the first probing and the attacks. Store owners largely did not detect it themselves.

Time to detect

Probing began 16 March at 12:00 UTC and Sansec's public warning followed the next day

Warning signs that were missed
  • Files with a .php, .phtml or .phar extension appearing in pub/media/custom_options/, a folder that should only hold images.
  • Guest cart API calls carrying a file_info block with an executable filename or an image that also contains code.
  • A new backdoor file, accesson.php, appearing in folders where it should not exist.
  • Unfamiliar JavaScript added to CMS pages and static blocks that loads from outside domains.

What to monitor for in your own environment

POST or PUT to the guest cart items endpoints with a file_info object in the body

WAF and API gateway logs

Any non-image file, or any file with an executable extension, created in pub/media/custom_options/

File-integrity monitoring on the web server

The same file name, accesson.php, in many unrelated folders, or a page that returns the fingerprint number 8194460

File-integrity monitoring and web access logs

New script references in CMS pages or static blocks pointing at unfamiliar domains

CMS change logs and content-security-policy reports

Requests probing the same API path from many unfamiliar IPs, which Sansec saw from more than 50 addresses by 23 March

Web access and WAF logs

Containment, eradication & recovery

Containment

Mar 16 onward
  • Block the vulnerable API calls at the edge with a WAF rule. Sansec says this is the only step that stops uploads, because blocking web access to the upload folder does not stop files being written.
  • Deny all web access to pub/media/custom_options/ in the web server configuration, ahead of any PHP handler on nginx, and confirm the Apache .htaccess file is present.
  • Use a protection service or WAF with PolyShell coverage. Akamai added it on 27 March.

Eradication

Mar 17 onward
  • Search pub/media/custom_options/ for any file other than the .htaccess, with any .php, .phtml or .phar file a strong sign of compromise.
  • Find accesson.php across the whole document root and remove every copy, since attackers spray it across many folders to survive clean-up.
  • Search CMS pages and static blocks for references to the loader domains Sansec names, and remove the injected JavaScript.

Recovery

May 12 – Jul 14
  • Upgrade to Magento 2.4.9, or apply the APSB26-73 backport on supported older lines.
  • Keep the server-side blocks in place after patching, because files already uploaded stay on disk and could become dangerous after a later configuration change.
  • Rescan for malware and for leftover backdoors after patching.

Security control analysis

Failed
Input validation on file upload (type, extension, option ID)

Three checks were missing and the only test, an image-header check, was trivially bypassed.

Absent
Authentication on the cart API

The guest cart routes are anonymous by design, which meant the upload needed no credentials.

Failed
Vendor patch availability

No isolated patch for production versions when the attacks began. The fix arrived in 2.4.9 on 12 May and in the supported lines on 14 July.

Partial
Web server configuration blocking execution in upload folders

Adobe's sample configuration limits the fallout, but most stores use a custom configuration from their hosting provider, and many exposed files in the upload folder.

Partial
WAF and virtual patching at the edge

Stores behind a service with a PolyShell rule were protected. Akamai added one on 27 March, and Sansec says Cloudflare had not published a rule when it wrote.

Unknown
File-integrity monitoring on the web root and upload folders

Nothing in the public sources says how many compromised stores had it. It is the control that would have shown the first uploaded file.

Held
Security-vendor research and disclosure

Sansec found the flaw, added protection on the day, and published within a day, which warned store owners before mass scanning began.

Controls that would have prevented or limited this

Fix
Block executable content in every user-upload folder at the web server, with PHP handling disabled there

Even a successful upload could not have run, which turns a remote-code-execution flaw into a clean-up job.

Closes: Web server configuration blocking execution in upload foldersCIS Control 4 — Secure Configuration of Enterprise Assets and Software
Fix
Put a WAF with virtual patching in front of every public store, and subscribe to vendor rule updates

The vulnerable API call is stopped at the edge, in the weeks before an official patch exists.

Closes: WAF and virtual patching at the edgeCIS Control 13 — Network Monitoring and Defense
Fix
Monitor file integrity on the web root and upload folders and alert on new executable files

The first uploaded shell appears as an alert on the day it lands, not as a found backdoor weeks later.

Closes: File-integrity monitoring on the web root and upload foldersCIS Control 8 — Audit Log Management
Fix
Make upload endpoints validate on the server: allowed types, re-encoding of images, random names, storage outside the web root

A disguised image carrying PHP would be rejected, or flattened into a plain image.

Closes: Input validation on file upload (type, extension, option ID)CIS Control 16 — Application Software Security
Fix
Track vendor security bulletins and have a written plan for vulnerabilities with no patch yet

Store teams know in advance to apply mitigations, not to wait for a release.

Closes: Vendor patch availabilityCIS Control 7 — Continuous Vulnerability Management

Blast radius

What attackers gained

  • Remote code execution on stores where the web server ran uploaded PHP
  • Persistent backdoors planted in many folders to survive clean-up and redeployment
  • A JavaScript loader on store pages that reaches every visitor
  • Stored XSS and account takeover on stores where execution was blocked but files could still be served

What limited the damage

  • Stores where the web server blocked PHP execution in the upload folder, though the files stayed on disk
  • Stores behind a WAF with a PolyShell rule
  • GraphQL, which uses a different code path and is not affected
  • Sansec's early public warning on 17 March, two days before the first attacks
Fig. 3 — The same flaw ended very differently depending on the web server setup and the edge in front of the store.

Share of all stores with malicious uploads, per Sansec

Mar 24 — malicious PHP uploaded56.7%Apr 14 — malicious uploads82%
Fig. 4 — Vendor telemetry across all stores Sansec tracks. A measure of how broad the campaign was, not a count of breaches.

What they got right

Sansec warned publicly within a day of finding the flaw and gave store owners exact mitigations, a find command and indicators of compromise.

The advice was honest about what works: blocking web access to the upload folder does not stop uploads, and only a WAF that blocks the API call itself does.

Akamai added a WAF rule within eleven days of the first warning, which gave many stores a protected route while waiting for a patch.

Adobe fixed the flaw in the 2.4.9 branch and later backported it to the supported release lines.

Why this keeps happening

Upload handlers are a classic place for a missing check, and a check that only looks at an image header is a check that attackers have beaten for years.

Anonymous endpoints are the cheapest thing in a store to attack at scale. Once a flaw sits behind one, scanning starts within days.

Open-source platforms are patched by a vendor, deployed by thousands of hosts, and configured differently everywhere, so a flaw's real impact depends on how each store was set up.

Lessons for your own environment

  1. Validate uploads on the server, every time

    Type, extension, content and name all need checking, and images should be re-encoded. An image-header check is not validation.

  2. An anonymous endpoint needs the strictest limits

    The guest cart route let anyone write a file to the server. Anything an unauthenticated visitor can write needs a hard allowlist.

  3. Stop the call at the edge, not just the folder

    Denying access to the upload folder left the files on disk. Only blocking the API call itself prevented the upload.

  4. A missing patch is a planning case, not an excuse

    For months there was no isolated production patch. Stores with a WAF, a blocked upload folder and file monitoring were already protected.

  5. Hunt for persistence, not just the first shell

    accesson.php copies were sprayed into many folders. Removing the first webshell leaves the others.

  6. Cached payloads outlive a blocked domain

    The JavaScript loader stores its payload in visitors' browsers, so blocking the loader's domain does not remove copies already stored.

CISO & board lessons

  • Ask which of your public-facing apps accept file uploads from unauthenticated users, and what stops a disguised file reaching an executable folder.
  • Confirm that every public site sits behind a WAF with virtual patching, and that someone owns the rule updates from the platform's vendor.
  • Require a written interim plan for any critical flaw with no vendor patch: edge rule, configuration change, monitoring, and a date to review.
  • Make file-integrity monitoring on web roots and upload folders a baseline control, with alerts that reach someone.
  • After an upload-flaw incident, treat the cleanup as incomplete until you have searched for backdoors in every writable folder and for injected scripts in your content.

Action plan

First 24 hours

  • Put a WAF rule in front of the guest cart items endpoints that blocks file_info content, or confirm your provider has one.
  • Deny all web access to pub/media/custom_options/, and on nginx place the rule before any PHP location block.
  • Search the upload folder for any .php, .phtml or .phar file, and for accesson.php across the whole document root.

First 7 days

  • Check CMS pages and static blocks for injected scripts and for the loader domains named in the research.
  • Review web access logs for guest cart calls with file_info and for probing from unfamiliar IP addresses.
  • Decide whether any store showed a sign of compromise and, if so, restore from a clean copy and review customer and payment exposure.

First 30 days

  • Upgrade to Magento 2.4.9 or apply the vendor backport for your supported line.
  • Turn on file-integrity monitoring for the web root and upload folders and send alerts to the on-call team.
  • Review every other upload endpoint in your stack against the same three checks: type, extension and where the file is written.

Could this happen in your organization?

  • Do you know every endpoint on your public sites that accepts a file from someone who is not logged in?
  • Is PHP execution disabled in every folder where uploaded files are stored?
  • Is a WAF with virtual patching in front of every public store, and does someone apply its rule updates?
  • Would you notice an executable file appearing in an upload folder today?
  • If your platform vendor had no patch for a month, what would you do in the meantime?
  • After a clean-up, do you search for backdoors in other folders and for injected scripts in your content?

If this happened to you: what to ask, and what to say

Knowing the lesson isn’t the same as knowing what to do with it Monday morning. A security lead, a CISO, and a customer-facing team each need something different from this incident.

  • “Which of our endpoints accept a file from an anonymous visitor?”
    The guest cart route was one, and it was enough.
  • “If a file with a .php extension landed in our upload folder, would the web server run it?”
    That single setting decided whether stores were compromised.
  • “Who is alerted if a new executable file appears under the web root?”
    File-integrity monitoring turns a weeks-old find into a same-day alert.
  • “What is our plan when the vendor patch is months away?”
    Write the edge rule, the config change and the review date before you need them.
  • Explain the exposure without a technical lecture.
    A public form could be used to place a program on the store's server.
    “A flaw in our shop platform let anyone place a hidden program on the server through the basket. A patch did not exist for months, so we relied on blocks in front of the shop and on checking the server for anything that should not be there.”
  • Separate what you know from what you do not.
    The vendor's percentages are not a count of your breaches.
    “We have confirmed which of our stores were exposed and what we found. Industry figures on how many stores were hit come from security vendors and are not a measure of our own exposure.”
  • Show it is closed beyond this one flaw.
    Boards want to know the pattern is covered.
    “We have blocked execution in every upload folder, put edge protection in front of public sites and added monitoring for new executable files.”
  • Say what could have been exposed on a store.
    A skimmer script reaches shoppers who are on the page.
    “Attackers can place scripts on shop pages that read what visitors type. We are checking for these and will tell you if payment or account details could have been exposed.”
  • Tell shoppers what to do.
    Practical steps rebuild trust faster than reassurance.
    “If you used the store in the affected period, watch your card statements and change your password if you reuse it elsewhere.”
  • Explain what changed.
    Concrete changes beat promises.
    “We now block the vulnerable request before it reaches the store, scan for unexpected files every day and applied the vendor's fix as soon as it was available for our version.”

References & confidence

  • ConfirmedSansec — PolyShell: unrestricted file upload in Magento and Adobe Commerce (published March 17, 2026, updated through July 2026) — Primary source for the technical cause, timeline, payloads and mitigations. Sansec is also a vendor of protection for these stores, so its percentages are vendor telemetry.
  • ReportedAdobe — security bulletins APSB25-94 and APSB26-73 — Cited in the Sansec timeline; the bulletins themselves were not read for this study.
  • ReportedCVE-2026-48356 — Identifier given by Sansec.
  • DisputedSansec — store attack percentages across protected and all stores — The figures use different denominators across the page and should not be compared directly.
  • UnknownBacklog headline: Brotli exploit traffic linked to PolyShell — Not found in Sansec's research. Left out of this study.
This case study is built entirely from public reporting on this incident — see References & confidence above for what's confirmed, reported, or still unconfirmed. Nothing here is an estimate or an illustrative placeholder.