Attackers used an OpenMage LTS RCE flaw to drop a web shell on a live store. The bug sits in the legacy product media API. It carries a medium CVSS score of 6.6, rising to 7.2 on stores with a separate SQL injection. OpenMage LTS 20.19.4, 20.18.6 and 21.0.0-beta7 fix it.
Technical Analysis
Attack Vector and Prerequisites
The flaw sits in the legacy API, which serves SOAP, XML-RPC and JSON-RPC requests. An attacker needs an API role with the Catalog > Product > Media > Update permission. In addition, they need a malicious gallery row in the database.
Normal store paths reject such rows. So the attacker must plant one through “a separate SQL injection, a compromised DB account, or a malicious module.” That extra step explains the high attack complexity rating.
Root Cause
The update() method in Mage_Catalog_Model_Product_Attribute_Media_Api has two gaps. First, it builds a file path from the gallery file name without confining it to the media directory (CWE-22). Second, it never checks that the uploaded bytes form an image (CWE-434).
As the OpenMage advisory explains, a crafted name “lets a media-API role write a file of arbitrary content anywhere the PHP process can write.” On most installs, that includes the document root. Notably, the sister create() method already validated images, but update() did not.
Affected Products, Impact, and Exploitation Status
Affected Versions
- OpenMage LTS 20.18.5 and earlier
- OpenMage LTS 20.19.0 through 20.19.3
- OpenMage LTS 21.0.0-beta1 through 21.0.0-beta6
Impact
This OpenMage LTS RCE flaw allows arbitrary file writes, which become code execution in a PHP directory. Even without a malicious gallery row, a media-update role “can overwrite an existing product image with arbitrary bytes.”
Exploitation Status
Exploitation in the wild is confirmed. According to OpenMage, attackers used a SQL injection to seed the gallery row. Then they sent a JSON-RPC update call to drop a web shell on a store running 20.19.1. The advisory reports this single incident and no wider campaign. The flaw has no CVE ID yet, so it does not appear in CISA’s KEV catalog.
Remediation and Mitigation
Official Patches
Upgrade to OpenMage LTS 20.19.4, 20.18.6 or 21.0.0-beta7. All three release tags are live on GitHub. The fix confines file names to the product media directory and re-encodes uploads as images.
Workarounds
- Block api.php and the legacy API endpoints at the web server if you do not use them.
- Alternatively, remove Media > Update from API roles.
- Block PHP execution under media/. Apache’s shipped .htaccess does this, but nginx needs its own rule.
Detection and Hunting
OpenMage suggests auditing the catalog_product_entity_media_gallery table for values containing “..”. Also, look for unexpected PHP files in the store root and media folders. Finally, patch any SQL injection, since it opens the door to this OpenMage LTS RCE chain.
Support Our Threat Intelligence
Find our vulnerability reports and weekly recaps helpful? Support our work today and unlock a 100% ad-free reading experience!