CVE-2026-25524: OpenMage LTS's Phar Deserialization leads to Remote Code Execution

Published Apr 20, 2026
·
Updated

Magento Long Term Support (LTS) is an unofficial, community-driven project provides an alternative to the Magento Community Edition e-commerce platform with a high level of backward compatibility. Prior to version 20.17.0, PHP functions such as getimagesize(), fileexists(), and isreadable() can trigger deserialization when processing phar:// stream wrapper paths. OpenMage LTS uses these functions with potentially controllable file paths during image validation and media handling. An attacker who can upload a malicious phar file (disguised as an image) and trigger one of these functions with a phar:// path can achieve arbitrary code execution. Version 20.17.0 patches the issue.

Other sources

PHP functions such as getimagesize(), fileexists(), and isreadable() can trigger deserialization when processing phar:// stream wrapper paths. OpenMage LTS uses these functions with potentially controllable file paths during image validation and media handling. An attacker who can upload a malicious phar file (disguised as an image) and trigger one of these functions with a phar:// path can achieve arbitrary code execution.

| Metric | Value | Justification | | ------------------------ | --------- | ------------------------------------------------ | | Attack Vector (AV) | Network | Exploitable via file upload and web requests | | Attack Complexity (AC) | High | Requires file upload + triggering phar:// access | | Privileges Required (PR) | None | Some upload vectors don't require authentication | | User Interaction (UI) | None | Exploitation is automatic once triggered | | Scope (S) | Unchanged | Impacts the vulnerable component | | Confidentiality (C) | High | Full system access via RCE | | Integrity (I) | High | Arbitrary code execution | | Availability (A) | High | Complete system compromise possible |

Affected Products

- OpenMage LTS versions < 20.16.1 - All versions derived from Magento 1.x with these code paths

Affected Files

| File | Line | Vulnerable Function | | --------------------------------------------------------- | ---- | ---------------------------------------------- | | app/code/core/Mage/Core/Model/File/Validator/Image.php | 72 | getimagesize($filePath) | | app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php | 137 | getimagesize($item->getFilename()) | | lib/Varien/Image.php | 71 | $this->getAdapter()->open($this->fileName) |

Vulnerability Details

PHP's phar (PHP Archive) format stores metadata that is serialized. When PHP's stream wrapper functions access a file using the phar:// protocol, the metadata is automatically deserialized. This occurs even with seemingly safe functions like fileexists() or getimagesize().

A polyglot file can be crafted that is both a valid image (passing initial validation) and a valid phar archive containing malicious serialized objects. When the application later processes this file using phar://, the deserialization triggers a gadget chain leading to RCE.

Attack Flow

1. Create polyglot file: Attacker creates a file that is both valid JPEG and valid PHAR 2. Upload file: Attacker uploads the polyglot via product images, CMS media, or import 3. Trigger phar:// access: Attacker causes the application to access the file using phar:// wrapper 4. Code execution: PHAR metadata deserialization triggers gadget chain

Proof of Concept

php <?php // Create malicious phar file class ExploitGadget { public $cmd = 'id > /tmp/pwned'; function destruct() { system($this->cmd); } }

$phar = new Phar('exploit.phar'); $phar->startBuffering(); $phar->addFromString('test.txt', 'test'); $phar->setStub('<?php HALTCOMPILER(); ?>'); $phar->setMetadata(new ExploitGadget()); $phar->stopBuffering();

// Rename to appear as image rename('exploit.phar', 'exploit.jpg');

// When getimagesize('phar://path/to/exploit.jpg') is called, // the ExploitGadget::destruct() method executes

Remediation

Block phar:// paths before passing to vulnerable functions:

php // Before (vulnerable) [$imageWidth, $imageHeight, $fileType] = getimagesize($filePath);

// After (fixed) if (strstartswith($filePath, 'phar://')) { throw new Exception('Invalid image path.'); } [$imageWidth, $imageHeight, $fileType] = getimagesize($filePath);

Additionally, ICO files (which cannot be re-encoded by GD) are now scanned for phar signatures:

- HALTCOMPILER(); - Required phar stub - <?php - PHP opening tag - <?= - PHP short echo tag

Additional hardening measures:

1. ICO uploads removed: ICO file support is completely removed from new image uploads. This eliminates the polyglot attack vector entirely since all other image formats are re-encoded by GD, which strips any embedded phar metadata.

2. Phar wrapper disabled: The phar:// stream wrapper is unregistered at application bootstrap, preventing any phar deserialization attacks regardless of code path.

3. Cache deserialization hardening: All unserialize() calls on cached data now use allowedclasses => false as defense-in-depth.

Note: Existing uploaded ICO files will continue to work. Only new ICO uploads will be rejected. Users are encouraged to use PNG favicons for new uploads.

Workarounds

If immediate upgrade is not possible:

1. Disable phar stream wrapper (if not needed):

ini ; php.ini disablefunctions = phar://

Or in code:

php streamwrapperunregister('phar');

2. Strict upload validation: Implement additional validation beyond file extension

3. File storage isolation: Store uploads outside web root with randomized names

4. Web Application Firewall: Block requests containing phar:// in parameters

Credit

This vulnerability was discovered and responsibly disclosed by blackhat2013 through HackerOne.

Timeline

- 2025-12-31: Vulnerability reported via HackerOne - 2026-01-21: Fix developed and tested

Source: https://hackerone.com/reports/3482926

GitHub

Affected Software

3 affected componentsFixes available
OpenMage OpenMage LTS<20.17.0
composer/openmage/magento-lts<20.17.0
20.17.0
OpenMage Magento<20.17.0

Event History

Apr 20, 2026
CVE Published
via MITRE·04:11 PM
Data Sourced
via MITRE·04:11 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:16 PM
Affected Software
Apr 21, 2026
Advisory Published
via GitHub·02:32 PM
Data Sourced
via GitHub·02:32 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-25524?

CVE-2026-25524 has a critical severity level due to its potential to allow remote code execution.

2

How do I fix CVE-2026-25524?

To fix CVE-2026-25524, upgrade OpenMage LTS to version 20.17.0 or later.

3

What does CVE-2026-25524 exploit in OpenMage LTS?

CVE-2026-25524 exploits a vulnerability in Phar deserialization.

4

Who is affected by CVE-2026-25524?

Any user of OpenMage LTS versions prior to 20.17.0 is affected by CVE-2026-25524.

5

Is there a workaround for CVE-2026-25524?

There is no recommended workaround for CVE-2026-25524; updating to the patched version is necessary.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203