Critical Magento OpenMage Flaw Could Let Hackers Execute Malicious Code on E-Commerce Servers
OpenMage has patched an arbitrary file-write flaw in its legacy product media API that could let attackers execute PHP code on e-commerce servers.
The advisory, GHSA-qjwx-wccq-qmj5, rates the flaw Moderate at 6.6 under CVSS 3.1 because exploitation requires both a privileged API role and a separate means of altering a product gallery record.
The maintainers report that attackers exploited the flaw as part of a compromise involving an OpenMage 20.19.1 store.
Critical Magento OpenMage Flaw
The defect resides in Mage_Catalog_Model_Product_Attribute_Media_Api::update(), a shared handler for SOAP, SOAP v2, XML-RPC, and JSON-RPC requests.
The handler constructs a filesystem path from a stored gallery filename without verifying that the resolved destination remains inside the product media directory.
It also checks the declared MIME type against an allowlist without validating the underlying bytes. That combination, classified as path traversal (CWE-22) and unrestricted upload of a dangerous file type (CWE-434), differs from the unauthenticated upload issue reported in Magento’s PolyShell flaw.
An API account needs the Catalog → Product → Media → Update permission. On the tested 20.19.3 release, ordinary gallery-writing workflows already reject path traversal, so reaching a destination outside the media directory also requires a manipulated database record.
The write becomes remote code execution only if the PHP process can write to a location where the server executes PHP. Even without a manipulated record, a privileged API account can overwrite an existing product image with non-image bytes.
Separate Magento web shell campaigns illustrate why incident responders should inspect the webroot rather than treating a software update as proof that a store is clean.
The affected Composer package, openmage/magento-lts, includes versions through 20.18.5, releases 20.19.0 through 20.19.3, and prereleases 21.0.0-beta1 through 21.0.0-beta6. OpenMage fixed the issue in 20.18.6, 20.19.4, and 21.0.0-beta7.
The patched handler verifies that the resolved destination stays inside the product media directory, requires an image extension, and validates and re-encodes the upload in a temporary file before replacing the original.
This brings media updates in line with the image validation already applied during creation. Operators unable to patch immediately should block unused legacy API endpoints at the web server or revoke the Media → Update permission from API roles that do not need it.
They should also verify that PHP execution is disabled under media/. OpenMage ships an Apache .htaccess rule for that directory, but nginx deployments need an equivalent server configuration. Disabling PHP execution under media/ does not address writes elsewhere, making the application patch essential.
For stores that exposed the legacy API, incident responders should audit catalog media records for anomalous paths, review legacy API access logs for unexpected media updates, and compare the webroot against a known-good deployment for unfamiliar PHP files.
Magento storefront malware investigations show why patching alone is insufficient after compromise: an update closes the file-write path but does not remove previously installed backdoors or injected storefront code.
Join 16,000+ SOC teams using ANY.RUN to streamline threat investigations and reduce manual effort. Explore for your team
The post Critical Magento OpenMage Flaw Could Let Hackers Execute Malicious Code on E-Commerce Servers appeared first on Cyber Security News.
Generated by your browser's model. Nothing was sent anywhere.
Reader notes
Notes are held for moderation. No account needed.