OpenMage Image API Flaw Already Used to Plant a Web Shell
OpenMage says a path traversal in its legacy product media API was chained with a SQL injection to drop a web shell on a live store. Update to 20.19.4 or 20.18.6 and audit gallery rows.
OpenMage, the community-maintained fork that keeps old Magento 1 stores running, has fixed a file-write bug in its legacy product image API that attackers already used to plant a web shell on a live store. Its security advisory, published December 3 alongside a large batch of other fixes, says the chain was used in the wild against a store running version 20.19.1, and that the bug was still present in 20.19.3. The fix is in 20.19.4 and 20.18.6.
For defenders
Affected: OpenMage LTS before 20.19.4 (and before 20.18.6 on the 20.18 line; 21.0.0-beta7 for the 21.x pre-releases). Advisory GHSA-qjwx-wccq-qmj5; no CVE assigned yet. OpenMage rates it Medium 6.6 (CVSS 3.1) on its own, and High 7.2 on any store where an attacker can also write to the database, for example through an unpatched SQL injection.
The bug: the legacy media API call catalog_product_attribute_media.update, reachable over SOAP, SOAP v2, XML-RPC and JSON-RPC, writes the content it receives to a path built from the image’s gallery file name. It never checks that the path stays inside media/catalog/product, and never checks that the content is really an image. A gallery entry like /../../../shell.php therefore lets an API user with the Media > Update permission write a PHP file into the store’s root folder.
Exploitation: KNOWN, per OpenMage. The in-the-wild chain used a SQL injection to insert a traversing gallery row into catalog_product_entity_media_gallery, then a JSON-RPC update call to drop a web shell. The advisory doesn’t say which SQL injection was used or who was behind it, and no indicators were published. The reporter, GitHub user hirale, also wrote the fix.
Fix: update to 20.19.4 or 20.18.6. Until then, OpenMage says to block api.php and /api/(soap|v2_soap|xmlrpc|jsonrpc) at the web server if you don’t use the legacy API (or remove Media > Update from API roles), make sure PHP can’t run under media/ (the shipped Apache .htaccess does this; nginx needs its own rule), and audit existing gallery rows with:
SELECT value_id, entity_id, value FROM catalog_product_entity_media_gallery WHERE value LIKE '%..%';
The same release fixes dozens of other OpenMage issues, several of them SQL injection and cross-site scripting bugs, so this is one update worth doing in full.
ATT&CK: T1190 (Exploit Public-Facing Application), T1505.003 (Server Software Component: Web Shell).
What it means for you
If you shop online, there’s nothing for you to do. If you run an online store on OpenMage or an old Magento 1 setup, a web shell is a hidden back door: whoever planted it can read your database or add a card skimmer to your checkout page, which is how shoppers’ card details get stolen. A store that looks fine from the front can still be compromised.
Do this now
- Update OpenMage to 20.19.4 (or 20.18.6) now.
- Run the gallery audit query above; any row containing
..needs investigating. - Look for unexpected
.phpfiles in the store’s root folder and undermedia/. - Not using the legacy SOAP/XML-RPC/JSON-RPC API? Block it at the web server.
Source article: Legacy product media API update() writes caller-supplied content to an unchecked path (RCE)
Publisher: OpenMage (GitHub security advisory GHSA-qjwx-wccq-qmj5)
Published: Dec. 3, 2026
URL: https://github.com/OpenMage/magento-lts/security/advisories/GHSA-qjwx-wccq-qmj5
Executive Summary
OpenMage LTS, the community fork of Magento 1 used by e-commerce stores that never migrated to Magento 2, disclosed on December 3, 2026 that its legacy product media API method catalog_product_attribute_media.update writes caller-supplied bytes to a path derived from a product’s gallery file name without confining it to the media directory or validating that the content is an image. The flaw was exploited in the wild against a store running 20.19.1 by an unidentified attacker; no actor name, alias or infrastructure has been published. The observed chain began with a SQL injection, not identified in the advisory, used to insert a gallery row whose value traverses out of media/catalog/product (for example /../../../poc.php) into catalog_product_entity_media_gallery; the attacker then called the update method over JSON-RPC with a PHP payload declared as image/png, which landed verbatim in the Magento root as a web shell. The objective is code execution on the storefront server, which on e-commerce sites typically leads to database theft and payment card skimming. The bug remained in 20.19.3 and is fixed in 20.19.4, 20.18.6 and 21.0.0-beta7. Hunt leads, false positive expectations and the advisory’s published audit query are detailed below; no indicators, hashes or detection rules were published.
ATT&CK chain: Initial Access → Persistence
Hunt Lead Grid
| Hunt Lead Level | Hunt Lead Name | ATT&CK | Risk of False Positives |
|---|---|---|---|
| 1 (Junior) | Traversing Media Gallery Rows | T1190 (Exploit Public-Facing Application) | Low. OpenMage says every normal save path already rejects a gallery value containing parent-directory segments, so a row containing .. should not exist on a healthy store. |
| 1 (Junior) | Unexpected PHP Files in the Store Root and Media Directory | T1505.003 (Server Software Component: Web Shell) | Low to Medium. Extension installs and core updates add PHP files to the root and app folders; comparing against the release manifest or a known-good deployment, and treating any PHP under media/ as suspect, keeps this clean. |
| 2 (Pro) | Legacy API Media Update Calls With Traversal or Non-Image Names | T1190 (Exploit Public-Facing Application) | Medium. Product feed and PIM integrations call media APIs routinely; the rule anchors on the update method combined with a file name containing .. or a non-image extension, which legitimate integrations do not send. |
| 3 (Elite) | Out-of-Band Gallery Write Followed by API Update and New PHP File | T1505.003 (Server Software Component: Web Shell) | Low once built. Each step alone can be benign, but a gallery row written outside the admin or import code paths, an update call for that product and a new PHP file in a web directory within a short window is the exploitation sequence itself. |
Traversing Media Gallery Rows
The exploit needs a gallery row whose stored value climbs out of the product media directory, because update() only accepts file names that match an existing gallery entry. In 20.19.3 every normal path that writes gallery values (admin product save, product API, duplicate and import) already rejects such a value, so in the observed attack the row was inserted directly into catalog_product_entity_media_gallery through a separate SQL injection. The advisory publishes the audit query that finds these rows, reproduced exactly below; run it on every OpenMage and Magento 1 database, and for any hit record the value_id, the entity_id (product) and the value, which reveals the target path and file name of the planted file.
SELECT value_id, entity_id, value FROM catalog_product_entity_media_gallery WHERE value LIKE '%..%';
Run it against production, staging and any restored backups, since a row seeded before the patch stays in the database after the upgrade and the patched update() will simply refuse it rather than remove it. A hit means someone could write to the database outside the application’s own checks, so the investigation has to cover that entry point (a SQL injection, a compromised database account or a malicious module) as well as the file the row pointed at. Deleting the row without finding the file and the database access path leaves both in place. Treat any hit as a compromise and escalate to incident response.
Hunt Lead Level: 1 (Junior Analyst)
ATT&CK: Initial Access → T1190 (Exploit Public-Facing Application)
Sources: “Legacy product media API update() writes caller-supplied content to an unchecked path (RCE)”, OpenMage, Dec. 3, 2026, https://github.com/OpenMage/magento-lts/security/advisories/GHSA-qjwx-wccq-qmj5 (source article)
Unexpected PHP Files in the Store Root and Media Directory
OpenMage’s reproduction shows the payload landing in the Magento root with exactly the submitted bytes when the gallery value is /../../../poc.php, and inside media/catalog/product subfolders when the value stays in the media tree but carries a non-image extension; the write fails only when the target directory does not exist, because the writer does not create folders. In the in-the-wild case the file was a web shell. The hunt is a file sweep for PHP (and other server-executable extensions such as .phtml and .phar) in the store root that are not part of the installed OpenMage release or a known extension, and for any executable script anywhere under media/, with creation or modification times and owner checked against deployment records.
Use file integrity monitoring, EDR file inventory or a scripted comparison against the release tarball or the deployment repository, sweeping current state plus any file created since the store last deployed. Check web server access logs for requests to the files you find, since a 200 response to a newly appeared root-level PHP file is how a web shell is used. On nginx, confirm separately that PHP execution is denied under media/, because the protective .htaccess only applies to Apache. Do not rely on file names alone: the advisory’s poc.php is an example, and real web shells are usually named to blend in. Any confirmed unknown PHP file is a compromise: preserve it, check checkout templates and JavaScript for skimmer code, and rotate the admin, database and payment integration credentials.
Hunt Lead Level: 1 (Junior Analyst)
ATT&CK: Persistence → T1505.003 (Server Software Component: Web Shell)
Sources: “Legacy product media API update() writes caller-supplied content to an unchecked path (RCE)”, OpenMage, Dec. 3, 2026, https://github.com/OpenMage/magento-lts/security/advisories/GHSA-qjwx-wccq-qmj5 (source article)
Legacy API Media Update Calls With Traversal or Non-Image Names
The write itself arrives as a catalog_product_attribute_media.update call through any of the legacy adapters, at api.php or under /api/soap, /api/v2_soap, /api/xmlrpc or /api/jsonrpc, with a file argument matching the traversing gallery value, a declared MIME type from the allowed image list (image/png in the advisory) and base64 content that is not actually an image. The in-the-wild attack used JSON-RPC. The detection is any request to the legacy API endpoints that invokes the media update method with a file name containing .. or a non-image extension, or whose decoded content begins with PHP tags rather than image magic bytes, together with the API user that made the call.
Request bodies are needed, so source this from a WAF or reverse proxy with POST body logging, or from application-level API logging if your deployment has it; plain access logs only show the endpoint. Sweep back as far as logs allow, since the advisory does not date the in-the-wild attack. Scope to the API users that hold Catalog > Product > Media > Update and baseline what their integrations normally send. Blocking the legacy API entirely is the right control only where no integration depends on it, so confirm with the integration owners first. A hit from an API user that should not touch media, or from an unfamiliar source address, means that API credential is compromised: disable it and pivot to the gallery-row and file sweeps.
Hunt Lead Level: 2 (Pro)
ATT&CK: Initial Access → T1190 (Exploit Public-Facing Application)
Sources: “Legacy product media API update() writes caller-supplied content to an unchecked path (RCE)”, OpenMage, Dec. 3, 2026, https://github.com/OpenMage/magento-lts/security/advisories/GHSA-qjwx-wccq-qmj5 (source article)
Out-of-Band Gallery Write Followed by API Update and New PHP File
The full chain OpenMage describes has three observable steps: an insert into catalog_product_entity_media_gallery that did not come from the admin product save, the product API, duplicate or import (in the observed case, a SQL injection), then a legacy API media update call for the same product’s file, then a new file of arbitrary content in a PHP-executing web directory. The correlation joins database audit events on that table to API request logs by product entity_id and file value, and then to file creation events on the web root by time and path, flagging the sequence within a window of hours.
This needs database audit logging (MySQL or MariaDB audit plugin, or a database activity monitoring tool) on writes to catalog_product_entity_media_gallery, request-body logging on the API, and file integrity events on the web root. Attribute legitimate gallery writes by database user and calling code path, and baseline them for 30 days so a write from an unexpected session stands out. Scope to stores that expose the legacy API to the internet. The same join generalizes to any application where a database row controls a file path, which is why it is worth building beyond this bug. A correlated sequence is a confirmed intrusion: isolate the server, preserve the database audit trail to identify the SQL injection or credential used, and rebuild from a clean deployment.
Hunt Lead Level: 3 (Elite)
ATT&CK: Initial Access → T1190 (Exploit Public-Facing Application); Persistence → T1505.003 (Server Software Component: Web Shell)
Sources: “Legacy product media API update() writes caller-supplied content to an unchecked path (RCE)”, OpenMage, Dec. 3, 2026, https://github.com/OpenMage/magento-lts/security/advisories/GHSA-qjwx-wccq-qmj5 (source article)
Hash Appendix
No file hashes were published by the source advisory for this activity.
References Appendix
- “Legacy product media API update() writes caller-supplied content to an unchecked path (RCE)”, OpenMage (GitHub security advisory GHSA-qjwx-wccq-qmj5), Dec. 3, 2026, https://github.com/OpenMage/magento-lts/security/advisories/GHSA-qjwx-wccq-qmj5