Subscribe
0%
Illustration for: OpenMage media API flaw GHSA-qjwx-wccq-qmj5 was used to plant a web shell. Update Magento 1 LTS to 20.19.4

OpenMage media API flaw GHSA-qjwx-wccq-qmj5 was used to plant a web shell. Update Magento 1 LTS to 20.19.4

OpenMage, the community fork that keeps Magento 1 stores alive, shipped 20.19.4, 20.18.6 and 21.0.0-beta7 on Dec 3 with 16 security fixes. One of them closes a media-API file-write bug that, according to the advisory as reported by GBHackers, was abused to drop a web shell on a live store.

Listen to this article0:00 / 6:09

OpenMage, the volunteer-maintained Long Term Support fork of Magento 1, released versions 20.19.4, 20.18.6 and 21.0.0-beta7 on Dec 3 to fix 16 security issues. One of them, GHSA-qjwx-wccq-qmj5, let a store's legacy product-media API write arbitrary files outside the media folder, and GBHackers reports that the advisory describes it being used to install a web shell on a store running OpenMage LTS 20.19.1.

Why it matters: OpenMage is the maintained code base for shops still running Magento 1, so its releases are their security patches. A web shell on a store server gives an attacker a foothold to read the database or tamper with checkout pages. Patching closes the hole, but it does not remove a backdoor that is already there.

What the bug is

We read the fix commit (ee79217, by contributor hirale, merged Dec 3) in the OpenMage repository. Its description says the legacy catalog_product_attribute_media.update call — reachable over SOAP, SOAP v2, XML-RPC and JSON-RPC — wrote whatever base64 content it received to the product media directory plus the stored gallery file name. That name was only matched against the product's gallery rows and never checked for .. segments, and the content was never checked to be an image.

So if a gallery row contained a path such as /../../../x.php, an API user with media-update rights could write any bytes, including a PHP script, anywhere the PHP process can write. The commit notes that such a row needs a separate database write to exist, because the normal save paths refuse it.

GBHackers, summarising the advisory, says maintainers attributed that database change in the reported incident to SQL injection, and that the advisory does not establish whether other merchants were targeted. It also reports that even without the database step, an account with only the media-update permission could overwrite existing product images with unvalidated content.

Detail Value
Advisory GHSA-qjwx-wccq-qmj5 (no CVE, per GBHackers)
CVSS 6.6; 7.2 where an attacker can already alter the database (per GBHackers)
Precondition An API role allowed to update product media
Reported incident Web shell on a store running OpenMage LTS 20.19.1
Vulnerable LTS 20.18.5 and earlier, 20.19.0–20.19.3, 21.0.0-beta1–beta6 (per GBHackers)
Fixed 20.18.6, 20.19.4, 21.0.0-beta7

We confirmed in the repository that the fix is in all three release tags, which were cut between 21:39 and 22:54 UTC on Dec 3. We could not open the GitHub advisory page itself this run, so the CVSS figures, affected ranges and incident details above come from GBHackers' report of it.

What the fix does

According to the commit, update() now refuses names that contain a NUL byte or .., that resolve outside the product media directory, or that lack an image extension; such calls fail with "Detected malicious path or filename input." The uploaded content goes to a temporary file and through the same image validator create() already used, which rejects non-images and re-encodes images before anything is copied into place.

The rest of the release

The 20.19.4 release carries 16 GHSA-tagged fixes, and the 20.18.6 backport carries the same count. Two are worth knowing about alongside the exploited one:

  • GHSA-c6j2-fqrr-hvqp: the media API create() call and the REST image endpoint could be made to copy a server file named in the upload into the public product gallery, which could expose files the web server normally blocks, such as downloadable products and customer uploads.
  • GHSA-f33f-mg8g-75p9: an SQL injection in how filter conditions were built, reachable through the SOAP and XML-RPC order, invoice, shipment and credit-memo list methods. The commit calls it a regression of an earlier fix. Neither the commit nor GBHackers' report says whether this is the injection used in the incident.

Others cover stored XSS in admin pages, restricted admin roles editing data they should not, an XPath query built from template codes, sendmail -f argument validation, and a multishipping discount bug.

What to do

  1. Upgrade now to 20.19.4 (or 20.18.6 if you are on the 20.18 line, 21.0.0-beta7 on the beta).
  2. Assume you may already be compromised if the legacy API is reachable. GBHackers relays the advisory's advice: review legacy API and web-server logs, audit product gallery records for unexpected paths, look for unfamiliar PHP files in web-accessible directories, and preserve logs and files before cleaning up.
  3. If you can't upgrade today, block the legacy API endpoints you don't use and remove the product-media update permission from API roles that don't need it.
  4. Check PHP is disabled in media. OpenMage's shipped media/.htaccess turns off PHP and denies .php/.phtml/.phar files on Apache; Nginx needs an equivalent rule. This does not fully cover this bug, because the traversal can write outside the media folder.

What to watch

No indicators of compromise have been published, and there is no CVE or CISA KEV entry yet. Watch the OpenMage advisory for an updated incident description and for any sign the attack has spread beyond the single store described.

Sources

  1. OpenMage magento-lts on GitHub — commit ee79217: keep media API image updates inside the product media directory (GHSA-qjwx-wccq-qmj5) github.com
  2. GBHackers — OpenMage Magento Zero-Day Vulnerability Actively Exploited to Deploy Web Shells on Online Stores gbhackers.com

#OpenMage#Magento 1#Magento LTS#e-commerce#web shell#PHP#patch now