PolyShell on Magento 2.4.8: Adobe's July 2026 patch, and the extra check we run
Ask AI about this article
Home / Blog / PolyShell on Magento 2.4.8: Adobe's July 2026 patch, and the extra check we run
If you run Magento Open Source or Adobe Commerce on 2.4.8 or anything older, and you have not applied Adobe's July 2026 patch, a stranger can write a file to your server. No login. No admin user. No API token. Just an HTTP request.
That is PolyShell. It is tracked as CVE-2026-48356, and Adobe rates it Critical, 9.6 out of 10. For four months the only fix was in the 2.4.9 line, with nothing for the versions most stores run. That changed on 14 July 2026: Adobe's bulletin APSB26-73 shipped the fix as isolated patches for 2.4.6, 2.4.7, 2.4.8 and 2.4.9. On 27 October, CISA added it to its catalog of vulnerabilities known to be exploited.
So the first job is Adobe's patch, and this post shows how to check whether you have it. We also wrote our own check on the upload path while there was no official fix, and ran it on a 2.4.8 store in production. It is still worth having as a second layer, and the whole thing is here, diff and all. You can check your own store in about five minutes, and you do not need to hire anyone to do it. Us included.
What is PolyShell, and why does "unauthenticated" matter?
A polyglot file is one file that is honestly two things at once. Picture a GIF with a real GIF89a header and real image data, and PHP code stuck on the end. Open it in an image viewer and you see a picture. Hand it to PHP and it runs code.
PolyShell is the trick of getting one of those onto a Magento server through the guest cart.
The upload path is the REST API for guest cart items:
POST /rest/<store>/V1/guest-carts/:cartId/itemsPUT /rest/<store>/V1/guest-carts/:cartId/items/:itemId
An attacker needs a guest cart ID and a product SKU. Both are easy to get on any storefront. The request carries a custom-option file_info object with base64 data and a filename the caller picks. The file lands in pub/media/custom_options/quote/.
Three checks are missing. The option ID is never validated against the product's real options. The option type is never gated. And the file extension is never checked at all.
The class doing the validating is Magento\Framework\Api\ImageContentValidator. Its isValid() does real work. It decodes the base64, runs getimagesizefromstring(), compares the declared MIME type against the sniffed one, and rejects forbidden characters in the name. A polyglot GIF passes every one of those, because it genuinely is a GIF. And because nothing looks at the extension, that genuinely-a-GIF file can be written to disk as shell.php.
GraphQL mutations go through different code and are not affected.
Now the word that matters. Most Magento security bugs need something first: an admin session, a customer login, an integration token, a specific third-party extension. PolyShell needs none of that. Anyone who can load your storefront can try it. That is the difference between "we will schedule this" and "we are doing this today".
Sansec named the attack and published the research on 17 March 2026. They reported that by 14 April, 82% of the stores they monitor had been hit with malicious uploads. This is not theoretical and it is not targeted. It is a sweep, and since October it has been on CISA's list of vulnerabilities exploited in the wild.
Which Magento and Adobe Commerce versions are affected?
Adobe's bulletin APSB26-73 lists 2.4.9, 2.4.8-p5, 2.4.7-p10 and 2.4.6-p15 as affected, and every earlier release of those lines. So 2.4.8, 2.4.7, 2.4.6 and everything older, until Adobe's July patch is on.
Note 2.4.9 in that list. Sansec saw the fix arrive in the 2.4.9 pre-releases, but Adobe's record counts plain 2.4.9 as affected and the July patch as the fix. Do not assume the upgrade alone covers you.
If you run a Mage-OS build, do not assume you are different. Run the checks below against your own vendor/ tree and see what you actually have.
Is there a fix for 2.4.8 now?
Yes, since 14 July 2026. APSB26-73 ships the fix as isolated patch files, not as a new release. There is one per line: 2.4.6, 2.4.7, 2.4.8 and 2.4.9, each dated July 2026.
On 2.4.8 it goes on top of 2.4.8-p5. If you are on an earlier 2.4.8 patch level, update to 2.4.8-p5 first, then apply the isolated patch. Adobe's isolated patches are not cumulative: they go on in order, and later 2026 bulletins have added more of them for 2.4.8 since July, so check Adobe's list for everything after this one too.
That is a far smaller job than the major version upgrade that was the only official route before July. It is still a job, on a live store with extensions and a test plan, and it is the first thing to do.
How do I check my own store?
Four checks. Run them from your Magento project root.
1. What version are you on?
bin/magento --version
No CLI handy? Read it out of composer:
grep product-community-edition composer.json
2.4.8 or below means vulnerable, unless somebody has already patched it by hand.
2. Is Adobe's July patch applied?
Download the isolated patch for your line from Adobe, unzip it, and dry-run it in reverse from the project root:
patch -p1 -R --dry-run -i <the .patch file from Adobe's zip>
If that succeeds, the patch is already applied. If it fails and the same command without -R succeeds, it is not applied yet. If both fail, you are probably not on the patch level it was cut for, which on 2.4.8 means you are not on 2.4.8-p5.
3. Has anything already been dropped on you?
find pub/media/custom_options/ -type f ! -name '.htaccess'
find pub/media/ -type f \( -name '*.php' -o -name '*.phtml' -o -name '*.phar' \)
The first lists everything in the directory this vulnerability writes into. Real customer uploads live there too, so a long list is not automatically bad news. Anything that is not a file a customer would plausibly have uploaded deserves a look.
The second should return nothing at all. If it returns something, stop reading and go deal with that.
4. Did anyone try to run it?
Search your webserver access log for requests to /media/custom_options/ that end in .php:
grep -E 'GET /media/custom_options/[^ ]*\.php' /var/log/nginx/access.log
The status code is the whole story:
- 404 means the webserver refused to execute it. The upload landed, the attempt failed.
- 200 means it ran. Treat the store as compromised, and get incident response help rather than a patch.
Sansec's published indicators are worth a grep too: a secondary backdoor named accesson.php, payloads often named index.php, 780index.php, bypass.phtml or json-shell.php, files carrying a GIF89a header with PHP inside them, and eval(base64_decode()) anywhere it does not belong.
Does an uploaded file actually run?
Not on its own, and this distinction is worth understanding before you either panic or relax.
Magento's own nginx.conf.sample whitelists the PHP entry points and denies everything else:
# PHP entry point for main application
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
try_files $uri =404;
fastcgi_pass fastcgi_backend;
# ...
}
# Banned locations (only reached if the earlier PHP entry point regexes don't match)
location ~* (\.php$|\.phtml$|\.htaccess$|\.htpasswd$|\.git) {
deny all;
}
With that in place, a .php file sitting in pub/media is just bytes. Requesting it returns 404 and PHP never sees it. That config is the thing standing between "files on disk" and "remote code execution", and it is why plenty of stores got swept without getting owned.
It is a mitigation, not a fix, and it is thinner than it looks:
- The files still get written. Your disk is still somebody else's drop box.
- One config change, one move to a new host, one vhost with a looser rule, and everything already sitting there goes live at once.
- The rule has to be right. A regex that only matches the last extension leaves room, which is the same trap the next section is about.
Patch the upload. Do not lean on the webserver alone.
Our extra check
We wrote this while there was no official fix for 2.4.8. With Adobe's patch available, it is a second layer on the same upload path, not a replacement for it, and a stopgap for a store that cannot get to 2.4.8-p5 this week.
It adds one method, isExtensionValid(), to Magento\Framework\Api\ImageContentValidator, and calls it from isValid(). That class is the choke point every API upload passes through before anything reaches disk.
Two rules:
- The final extension must be in an allowlist:
jpg,jpeg,png,gif,webp,bmp,tiff. - No dot-separated segment anywhere in the name may be a known executable extension.
Here it is in full.
diff --git a/vendor/magento/framework/Api/ImageContentValidator.php b/vendor/magento/framework/Api/ImageContentValidator.php
--- a/vendor/magento/framework/Api/ImageContentValidator.php
+++ b/vendor/magento/framework/Api/ImageContentValidator.php
@@ -16,6 +16,32 @@
class ImageContentValidator implements ImageContentValidatorInterface
{
/**
+ * Image extensions accepted on the API upload path.
+ *
+ * PolyShell (CVE-2026-48356) hardening. MIME sniffing alone is not enough: a polyglot
+ * file - a genuinely valid GIF or PNG with PHP appended - passes
+ * getimagesizefromstring() and carries a real image MIME type, yet could still be
+ * written to disk under a name like "shell.php". This is an allowlist.
+ *
+ * @var string[]
+ */
+ private const ALLOWED_EXTENSIONS = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'tiff'];
+
+ /**
+ * Extensions refused anywhere in the name, not just at the end.
+ *
+ * A misconfigured web server can execute "shell.php.gif" on the strength of an
+ * interior segment, so every dot-separated segment is checked, not only the last.
+ *
+ * @var string[]
+ */
+ private const FORBIDDEN_SEGMENTS = [
+ 'php', 'php3', 'php4', 'php5', 'php7', 'php8', 'phps', 'phtml', 'phtm', 'phar',
+ 'shtml', 'shtm', 'htaccess', 'htpasswd', 'user', 'ini', 'html', 'htm', 'svg',
+ 'js', 'cgi', 'pl', 'py', 'sh', 'jsp', 'asp', 'aspx',
+ ];
+
+ /**
* @var array
*/
private $defaultMimeTypes = [
@@ -63,6 +89,9 @@
if (!$this->isNameValid($imageContent->getName())) {
throw new InputException(new Phrase('Provided image name contains forbidden characters.'));
}
+ if (!$this->isExtensionValid($imageContent->getName())) {
+ throw new InputException(new Phrase('Provided image file extension is not allowed.'));
+ }
return true;
}
@@ -91,4 +120,36 @@
}
return true;
}
+
+ /**
+ * Check that the file name carries an allowed image extension
+ *
+ * The final extension must be in self::ALLOWED_EXTENSIONS, and no dot-separated
+ * segment anywhere in the name may be one of self::FORBIDDEN_SEGMENTS. Checking
+ * every segment rather than only the last is what rejects "shell.php.gif", while
+ * still accepting ordinary multi-part names such as "nuvo-8108gc.v2.jpg".
+ *
+ * @param string $name
+ * @return bool
+ */
+ protected function isExtensionValid($name)
+ {
+ if ($name === null || $name === '' || strpos($name, "\0") !== false) {
+ return false;
+ }
+ $segments = explode('.', strtolower($name));
+ if (count($segments) < 2) {
+ return false;
+ }
+ $extension = array_pop($segments);
+ if (!in_array($extension, self::ALLOWED_EXTENSIONS, true)) {
+ return false;
+ }
+ foreach ($segments as $segment) {
+ if (in_array(trim($segment), self::FORBIDDEN_SEGMENTS, true)) {
+ return false;
+ }
+ }
+ return true;
+ }
}
Why check every segment, not just the last one
This is the part worth copying even if you write your own version.
The obvious implementation reads the final extension:
$ext = pathinfo($name, PATHINFO_EXTENSION);
For shell.php.gif that returns gif. The check passes. The file gets written to disk with .php sitting in the middle of its name.
On a correctly configured server that file is inert. On a server with a looser PHP rule, or one that matches on any extension in the name rather than only the last one, that interior .php is enough to get it executed. Any check that reads only the final extension has this hole by construction. Walking every dot-separated segment closes it, and costs one explode().
Why it still accepts nuvo-8108gc.v2.jpg
The tempting simplification is "one dot only". It would be shorter, and it would break the store.
ImageContentValidator is not only on the guest-cart path. It also gates API product image uploads through ProductRepository and GalleryManagement. That is how vendor catalogue sync pushes images in, and vendor image filenames have dots in them all the time: part numbers, revisions, variants.
A single-dot rule would start rejecting legitimate catalogue images on the first sync after deploy, somebody would pull the patch back out to get the sync running, and the store would be unprotected again by Friday. A security control that breaks the business gets removed. That is not a hypothetical, it is how these things actually die.
So the rule is shaped around what is actually dangerous. The last segment has to be an image type, and no segment anywhere may be executable. nuvo-8108gc.v2.jpg passes. shell.php.gif does not.
How was it tested?
Against a real GIF/PHP polyglot built with imagegif() and confirmed to sniff as image/gif, with the unpatched class as the control so we knew the test could actually fail:
| Class | Filename | Result |
|---|---|---|
| Unpatched | shell.php |
ACCEPTED, the vulnerability reproduced |
| Patched | shell.php |
BLOCKED |
| Patched | shell.php.gif |
BLOCKED, double-extension bypass |
| Patched | legit.gif |
ACCEPTED |
| Patched | nuvo-8108.v2.gif |
ACCEPTED, vendor sync name |
24 filename unit cases pass. Afterwards, a real multipart storefront add-to-cart with a genuine PDF attachment still went through, which matters: the storefront form is a different code path, and the patch must not touch it.
How do I apply it?
Adobe's patch first, following Adobe's instructions for isolated patches. Then, if you want the second layer, ours, from the project root:
patch -p1 -i m2-hotfixes/PolyShell_extra-check_248-p5.patch
bin/magento cache:flush
# then restart PHP-FPM, or opcache keeps serving the old class
Staging first. The hunks were cut against 2.4.8-p5, so patch will usually apply them with a line offset on neighbouring versions. If it rejects, the change is small enough to make by hand. Adobe's isolated patch lives under vendor/ too, so the next section applies to it just as much.
How do I make the patch survive composer install?
This matters as much as applying it, and it is where hand-patched stores quietly go back to being vulnerable.
The file lives under vendor/. .gitignore excludes vendor/, and composer rewrites it on every install. So a patch applied by hand on the server vanishes at the next deploy, with nothing in git to show the store was ever patched at all. It goes back to unpatched, and nobody gets told.
The pattern that works: keep .patch files in an m2-hotfixes/ directory at the project root, commit them, and re-apply them from composer's own hooks.
"scripts": {
"post-install-cmd": [
"bash m2-hotfixes/apply.sh"
],
"post-update-cmd": [
"bash m2-hotfixes/apply.sh"
]
}
If those keys already have entries, append to the arrays instead of replacing them.
Here is apply.sh. Two properties do the real work. It is idempotent, so running it twice is safe. And it exits non-zero when a patch will not apply, so a deploy fails loudly instead of quietly shipping an unpatched storefront.
#!/usr/bin/env bash
#
# Re-applies Adobe security hotfixes after every `composer install`.
#
# Why this exists: the files these hotfixes touch live under vendor/ and pub/,
# and .gitignore excludes both (/vendor/* and /pub/*). Composer rewrites vendor/
# on every install, so a hotfix applied by hand on the server silently vanishes
# at the next deploy, and nothing in git would ever show the store had been
# patched at all.
#
# Adobe does not support applying its official hotfixes via
# cweagans/composer-patches (extra.patches), so these are applied the way Adobe
# documents instead: `patch -p1` from the project root.
#
# Adding a hotfix: drop the .patch file in this directory. That is the whole step.
#
# This script is idempotent - it detects already-applied patches and skips them.
# It exits non-zero if a patch will not apply, so a deploy fails loudly rather
# than quietly shipping an unpatched storefront.
set -uo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT" || { echo "[hotfixes] cannot cd to project root"; exit 1; }
shopt -s nullglob
patches=("$ROOT"/m2-hotfixes/*.patch)
if (( ${#patches[@]} == 0 )); then
echo "[hotfixes] no .patch files in m2-hotfixes/ - nothing to do"
exit 0
fi
failed=0
for f in "${patches[@]}"; do
name="$(basename "$f")"
if patch -p1 -R --dry-run -s -f -i "$f" >/dev/null 2>&1; then
echo "[hotfixes] already applied: $name"
elif patch -p1 --dry-run -s -f -i "$f" >/dev/null 2>&1; then
if patch -p1 -s -f -i "$f" >/dev/null 2>&1; then
echo "[hotfixes] APPLIED: $name"
else
echo "[hotfixes] FAILED while applying: $name"
failed=1
fi
else
echo "[hotfixes] ERROR: cannot apply $name"
echo "[hotfixes] It neither applies cleanly nor is already applied."
echo "[hotfixes] The storefront may be UNPATCHED. Investigate before deploying."
failed=1
fi
done
exit "$failed"
Adding another hotfix later is one step: drop the .patch file in the directory.
What this patch does not do
Three honest limits.
It does not clean up files already on disk. If check 3 turned something up, this patch stops the next upload and does nothing about the last one. Find those files, quarantine them, and work out how they got there.
It does not fix a misconfigured webserver. If PHP will execute anything under pub/media, you have a second problem and this diff does not touch it.
It does not change the storefront form upload path. Custom option uploads that arrive as a normal $_FILES post into ValidatorFile behave exactly as they did before. That path was not the hole, and we did not go near it.
And the biggest limit: this is our check, not Adobe's fix. It closes the specific hole that lets an attacker choose a dangerous filename on the API path. Adobe's July patch is a different and broader change, and it is the one to apply. Ours is a second layer on top of it, or what you run for the few days until you can.
What if you found something you cannot explain?
If check 3 turned up files in pub/media/custom_options/ that no customer would have uploaded, patching is not the next thing to do. Something was written to your store. The questions that matter now are different ones. Did it run. What else did it touch. Did anything leave. Is there a second way back in that has nothing to do with this vulnerability any more.
That is incident response, not a patch, and it is worth being blunt about the limits. Nobody can tell you whether data was taken by looking at a filename. It takes the logs, the database, a file integrity check and somebody reading all three together. Anyone who tells you otherwise without looking is guessing.
If that is where you are, use our contact form and say so in the message. Put "compromised" or "PolyShell" in the first line so it gets read as what it is. This is a live campaign being swept across the whole platform, on CISA's list of exploited vulnerabilities, so hours matter here more than they usually do.
If your checks came back clean, or you are not sure how to read what they returned, that is worth a second pair of eyes too. We do security audits on Magento Open Source, Adobe Commerce and Mage-OS builds, including stores we did not build and have never touched: what version you are actually on, what is really in vendor/, what the webserver will execute, what is sitting in pub/media, and which admin accounts and integration tokens still exist that should not. It is the same work as support and maintenance, pointed at one question.
One thing worth saying plainly. A clean check today plus a patched validator does not add up to a clean store. It adds up to a store that is harder to write to than it was yesterday. Those are two different claims and we are not going to make the bigger one for you.
Either way, bring specifics when you write. What find pub/media/custom_options/ -type f ! -name '.htaccess' printed. What bin/magento --version says. Whether that access log grep came back 404 or 200. Three lines like that gets you a real answer far faster than "we think we might have a problem", and it means the first reply is about your store instead of about scheduling a call.
Sources
- Adobe security bulletin APSB26-73, 14 July 2026, the fix for 2.4.6 to 2.4.9: adobe.com/trust/security/products/magento/apsb26-73.html
- The CVE record, CVE-2026-48356: cveawg.mitre.org/api/cve/CVE-2026-48356
- Adobe's isolated patches for the July bulletin, and how to apply them: experienceleague.adobe.com/en/docs/experience-cloud-kcs/kbarticles/ka-37421
- Adobe's release notes for 2.4.8 security patches: experienceleague.adobe.com/en/docs/commerce-operations/release/notes/security-patches/2-4-8-patches
- CISA's Known Exploited Vulnerabilities catalog: cisa.gov/known-exploited-vulnerabilities-catalog
- Sansec, who named PolyShell and published the research on 17 March 2026: sansec.io/research/magento-polyshell
- Akamai's write-up: akamai.com/blog/security-research/magento-polyshell-latest-magento-threat-apsb25-94
- Searchlight Cyber's analysis: slcyber.io/research/magento-polyshell-unauthenticated-file-upload-to-rce-in-magento-apsb25-94
Take it
The check is yours. Copy it, widen the allowlist, rename the method, drop it in your own hotfix directory. There is nothing clever in it and nothing proprietary about it, and a hole this wide is a bad thing for anyone to sit on a fix for.
If you run it and find a filename it gets wrong, we would genuinely like to hear about it. That is more useful to us than a lead.