CVE-2025-58449: Mahocommerce/maho Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-vgmm-27fc-vmgp
CWE-646
Published
Advisory Summary

CVE-2025-58449 is a HIGH remote code execution vulnerability (CWE-646: Reliance on File Name or Extension of Externally-Supplied File) affecting Mahocommerce/maho libraries in the Packagist ecosystem. The issue involves maho is vulnerable to authenticated remote code execution via file upload. Remediation is available by upgrading affected packages to version 25.9.0.

CVE-2025-58449 at a Glance

CVE Identifier CVE-2025-58449
GHSA Identifier GHSA-vgmm-27fc-vmgp
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-646: Reliance on File Name or Extension of Externally-Supplied File
Affected Product Mahocommerce/maho
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2025-58449

To remediate this vulnerability, upgrade all affected Mahocommerce/maho dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mahocommerce/maho fixed: 25.9.0
Upgrade mahocommerce/maho to 25.9.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for mahocommerce/maho

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-58449, inspect your project dependencies for Mahocommerce/maho:

inspect dependencies for mahocommerce/maho

Analyze the terminal output to locate any version of Mahocommerce/maho in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 25.9.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-646: Reliance on File Name or Extension of Externally-Supplied File, where the product allows a file to be uploaded, but it relies on the file name or extension of the file to determine the appropriate behaviors. this could be used by attackers to cause the file to be misclassified and processed in a dangerous fashion. In Mahocommerce/maho, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary In Maho 25.7.0, an authenticated staff user with access to the `Dashboard` and `Catalog\Manage Products` permissions can create a custom option on a listing with a file input field. By allowing file uploads with a `.php` extension, the user can use the filed to upload malicious PHP files, gaining remote code execution ### Details An user with the `Dashboard` and `Catalog\Manage Products` permissions can abuse the product custom options feature to bypass the application’s file upload restrictions. When creating a product custom option of type file upload, the user is allowed to define their own extension whitelist. This bypasses the application’s normal enforced whitelist and permits disallowed extensions, including `.php`. The file uploaded by the custom option is then written to a predictable location: ``` /public/media/custom_options/<first char of filename>/<second char of filename>/<md5 of file contents>.php ``` Because this path is directly accessible under the application’s webroot, an attacker can then request the uploaded file via HTTP, causing the server to execute the PHP payload. ### PoC 1. Sign in to the `/admin` dashboard as a staff user. Ensure the user's role has access to the `Dashboard` and `Catalog\Manage Products` permissions. 2. Navigate to a product catalog listing, for example by clicking on a product linked within the `Most Viewed Products` tab on the dashboard. <img width="648" height="194" alt="image" src="https://github.com/user-attachments/assets/1ab69182-68ea-48e4-b50b-46ccf70f40bb" /> 3. Navigate to the "Custom Options" tab on the product, and create a custom option with a file upload field. Add `.php` as an allowed extension to the file upload configuration. Save the configuration after making the changes. <img width="836" height="391" alt="image" src="https://github.com/user-attachments/assets/5abe7d80-c16d-4b54-9a19-799bda1bcc34" /> 4. In a private window, navigate to the customer facing page for the product, and upload a reverse shell PHP file through the newly configured option. Then click "Add to cart" to complete the upload. <img width="473" height="286" alt="image" src="https://github.com/user-attachments/assets/326ce37e-026a-4211-8e95-6f5f310727df" /> 5. Calculate the location of the uploaded file on the web server as ``` /public/media/custom_options/<first char of filename>/<second char of filename>/<md5 of file contents>.php ``` 6. Navigate to the above path directly to execute the file contents and trigger the reverse shell. <img width="910" height="339" alt="image" src="https://github.com/user-attachments/assets/e0e52607-81d5-4dc2-8550-ef324182f889" /> ### Impact This vulnerability allows remote code execution (RCE) on the server. It requires only the Catalog\Manage Products permission, and does not need full administrative access. By leveraging the custom option upload feature, an attacker can bypass the application’s normal file upload protections and execute arbitrary PHP code within the webroot. ### Suggested Remediation Enforce a whitelist of allowed extensions a user is allowed to configure for file upload fields in Custom Options.

CVE-2025-58449 Affected Mahocommerce/maho Versions

1 component(s)
Fixed Versions:
25.9.0
Product / Package Ecosystem Affected Versions Fixed Version
mahocommerce/maho
Packagist
< 25.9.0
25.9.0

References

Frequently Asked Questions

What is CVE-2025-58449?
CVE-2025-58449 is a security vulnerability in Mahocommerce/maho involving Maho is Vulnerable to Authenticated Remote Code Execution via File Upload under CWE-646: Reliance on File Name or Extension of Externally-Supplied File.
Which Mahocommerce/maho versions are affected?
Affected versions include releases prior to 25.9.0 across affected packages: mahocommerce/maho.
What version fixes CVE-2025-58449?
Upgrading to 25.9.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mahocommerce/maho affected?
Yes, mahocommerce/maho is affected in releases prior to 25.9.0. Upgrade your dependency to 25.9.0 or later.
What CWE is associated with CVE-2025-58449?
CVE-2025-58449 is classified under CWE-646: Reliance on File Name or Extension of Externally-Supplied File (The product allows a file to be uploaded, but it relies on the file name or extension of the file to determine the appropriate behaviors. This could be used by attackers to cause the file to be misclassified and processed in a dangerous fashion.).
How can I check Packagist dependencies for CVE-2025-58449?
Run the dependency tree command: 'inspect dependencies for mahocommerce/maho'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vgmm-27fc-vmgp",
  "modified" : "2025-09-09T20:52:24Z",
  "published" : "2025-09-09T20:52:24Z",
  "aliases" : [ "CVE-2025-58449" ],
  "summary" : "Maho is Vulnerable to Authenticated Remote Code Execution via File Upload",
  "details" : "### Summary\nIn Maho 25.7.0, an authenticated staff user with access to the `Dashboard` and `Catalog\\Manage Products` permissions can create a custom option on a listing with a file input field. By allowing file uploads with a `.php` extension, the user can use the filed to upload malicious PHP files, gaining remote code execution\n\n### Details\nAn  user with the `Dashboard` and `Catalog\\Manage Products` permissions can abuse the product custom options feature to bypass the application’s file upload restrictions.\n\nWhen creating a product custom option of type file upload, the user is allowed to define their own extension whitelist. This bypasses the application’s normal enforced whitelist and permits disallowed extensions, including `.php`.\n\nThe file uploaded by the custom option is then written to a predictable location:\n```\n/public/media/custom_options/<first char of filename>/<second char of filename>/<md5 of file contents>.php\n```\nBecause this path is directly accessible under the application’s webroot, an attacker can then request the uploaded file via HTTP, causing the server to execute the PHP payload.\n\n### PoC\n1. Sign in to the `/admin` dashboard as a staff user. Ensure the user's role has access to the `Dashboard` and `Catalog\\Manage Products` permissions.\n2. Navigate to a product catalog listing, for example by clicking on a product linked within the `Most Viewed Products` tab on the dashboard.\n<img width=\"648\" height=\"194\" alt=\"image\" src=\"https://github.com/user-attachments/assets/1ab69182-68ea-48e4-b50b-46ccf70f40bb\" />\n\n3. Navigate to the \"Custom Options\" tab on the product, and create a custom option with a file upload field. Add `.php` as an allowed extension to the file upload configuration. Save the configuration after making the changes.\n<img width=\"836\" height=\"391\" alt=\"image\" src=\"https://github.com/user-attachments/assets/5abe7d80-c16d-4b54-9a19-799bda1bcc34\" />\n\n4. In a private window, navigate to the customer facing page for the product, and upload a reverse shell PHP file through the newly configured option. Then click \"Add to cart\" to complete the upload.\n<img width=\"473\" height=\"286\" alt=\"image\" src=\"https://github.com/user-attachments/assets/326ce37e-026a-4211-8e95-6f5f310727df\" />\n\n5. Calculate the location of the uploaded file on the web server as \n```\n/public/media/custom_options/<first char of filename>/<second char of filename>/<md5 of file contents>.php\n```\n6. Navigate to the above path directly to execute the file contents and trigger the reverse shell.\n<img width=\"910\" height=\"339\" alt=\"image\" src=\"https://github.com/user-attachments/assets/e0e52607-81d5-4dc2-8550-ef324182f889\" />\n\n### Impact\nThis vulnerability allows remote code execution (RCE) on the server. It requires only the Catalog\\Manage Products permission, and does not need full administrative access. By leveraging the custom option upload feature, an attacker can bypass the application’s normal file upload protections and execute arbitrary PHP code within the webroot.\n\n### Suggested Remediation\nEnforce a whitelist of allowed extensions a user is allowed to configure for file upload fields in Custom Options.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:A/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "mahocommerce/maho"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "25.9.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/MahoCommerce/maho/security/advisories/GHSA-vgmm-27fc-vmgp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-58449"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/MahoCommerce/maho/commit/db54a1b44e9b3fd26b27ca4d5ece0af99c4dcb53"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/MahoCommerce/maho"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-646" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-09-09T20:52:24Z",
    "nvd_published_at" : "2025-09-08T22:15:34Z"
  }
}