/

CVE-2026-25524

Severity:

HIGH RISK

(8.1)

Unsafe Deserialization in OpenMage LTS Media Handling

CVE-2026-25524

Analyzed

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

OpenMage LTS is vulnerable to unsafe PHP object deserialization through PHAR stream wrappers used in image validation and media handling.

If an attacker can upload a malicious PHAR file disguised as an image and cause functions like getimagesize(), file_exists(), or is_readable() to operate on a phar:// path, they may achieve arbitrary code execution on the server.

Affected context

This issue arises in OpenMage LTS installations that process user-supplied media or images and then pass file paths into PHP functions that implicitly trigger PHAR metadata parsing.

The vulnerability is relevant when:

  • Users or integrations can upload images or media files
  • The application stores uploaded files in locations that may contain PHAR archives
  • File validation and image-handling routines rely on getimagesize(), file_exists(), is_readable(), or similar functions without constraining the use of phar:// stream paths

Exploit preconditions

  • Attack surface: Web-facing media upload and image-processing endpoints.
  • Required access: Ability to upload or cause storage of attacker-controlled files to locations later processed by OpenMage.
  • Trigger point: Execution of PHP functions such as getimagesize(), file_exists(), or is_readable() on a path that resolves to a phar:// stream targeting the malicious file.
  • Why exploitation is possible: PHP's PHAR implementation parses metadata using unserialize-like behavior whenever a PHAR archive is accessed via phar://. When OpenMage passes controllable paths into these functions, it inadvertently causes deserialization of attacker-controlled metadata, enabling execution of gadget chains present in the application or its dependencies.

Why this happens

The core issue stems from relying on generic filesystem and image inspection functions that implicitly trigger PHAR deserialization when given phar:// URLs.

Under the hood, accessing a PHAR archive via phar:// causes PHP to process the archive's metadata using object deserialization semantics. In OpenMage LTS, user-influenced file paths can be passed to functions such as getimagesize(), file_exists(), and is_readable() without first ensuring that PHAR wrappers are disallowed.

This aligns with CWE-502: Unsafe Deserialization, where untrusted data (PHAR metadata) is deserialized, allowing attackers to invoke gadget chains in the codebase. The pattern is not a logic error in the functions themselves but in the assumption that they are safe to call on arbitrary, user-controllable paths.

Potential impact

  • Execution of arbitrary PHP code in the context of the web server process
  • Complete compromise of the OpenMage application and underlying storefront data
  • Theft or modification of customer information, including orders and account details
  • Tampering with product catalogs, prices, and checkout flows
  • Use of the compromised server as a pivot point for broader infrastructure attacks

General mitigation guidance

Effective mitigation centers on reducing trust in user-controlled file paths and avoiding implicit PHAR deserialization:

  • Treat all uploaded file paths as untrusted and strictly constrain where and how they are used.
  • Prevent the use of phar:// stream wrappers for application-controlled file operations, for example by validating schemes and rejecting or normalizing paths that include unexpected wrappers.
  • Enforce strict content-type and file-format validation for uploads, using robust server-side checks that do not rely solely on getimagesize() or similar functions.
  • Consider isolating upload handling into a reduced-privilege environment (e.g., separate process or container) so that even if deserialization occurs, the blast radius is limited.
  • Apply the principle of least privilege to the web server and PHP runtime, minimizing filesystem and database permissions.
  • Incorporate a secure-by-default media handling layer that does not rely on functions known to trigger PHAR processing on attacker-controllable input.

How teams detect issues like this

Organizations can look for this bug pattern using a combination of static and process-level detection:

  • Static analysis: Flag calls to getimagesize(), file_exists(), is_readable(), and similar filesystem APIs when their arguments can be influenced by user input or file uploads, especially where phar:// is not explicitly excluded.
  • Code review: Examine image validation, upload, and media-management flows for:
  • Direct or indirect use of user-controlled paths
  • Lack of path normalization or scheme validation
  • Assumptions that certain file extensions guarantee safe content
  • Configuration / policy enforcement: Implement platform policies that forbid phar:// usage in high-risk contexts and enforce safe upload handling patterns in shared libraries and frameworks.
  • Runtime monitoring: Instrument logging around upload endpoints and file operations to detect unexpected phar:// paths or anomalous PHAR access patterns, then correlate with security alerts.

Sources

SourceLink
github.comgithub.com/OpenMage/magento-lts/releases/tag/v20.17.0
github.comgithub.com/OpenMage/magento-lts/security/advisories/GHSA-fg79-cr9c-7369

Frequently asked

questions

Exploitability depends on how easily an attacker can upload or place a PHAR file and influence the resulting file path. In typical e-commerce deployments where customers can upload media (e.g., product images, profile pictures, or content via extensions), the attack surface can be significant.

Often, some level of access is required to reach upload or media-handling functionality. This may range from a standard customer account to higher-privileged roles, depending on how the site is configured and which modules are installed. Public upload endpoints expand the risk considerably.

The most robust approach is to ensure that user-controlled paths are never passed to PHP functions that can trigger PHAR deserialization, either by disallowing phar:// schemes outright or by centralizing file access through a vetted abstraction. Additionally, tightening upload validation and segregating upload processing into a least-privilege environment reduces the impact of any remaining issues.

Adopt a defensive design posture for file and media handling: treat all upload-derived input as untrusted, enforce strict validation and normalization of paths, avoid dangerous stream wrappers, and include checks for PHAR-related patterns in your secure code review and automated analysis. Regularly review framework and library usage to identify APIs with hidden side effects like implicit deserialization.

Find out what's already
exploitable in your codebase.