Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2024-39397

CVE-2024-39397: Adobe Commerce RCE Vulnerability

CVE-2024-39397 is a remote code execution flaw in Adobe Commerce caused by unrestricted file upload. Attackers can upload malicious files to execute arbitrary code on servers. This article covers technical details, affected versions, impact, and mitigation strategies.

Updated:

CVE-2024-39397 Overview

CVE-2024-39397 is an unrestricted file upload vulnerability affecting Adobe Commerce and Magento Open Source. The flaw allows an unauthenticated attacker to upload a file of a dangerous type, which can then be executed on the server to achieve arbitrary code execution. The issue is classified under CWE-434 (Unrestricted Upload of File with Dangerous Type). Affected versions include Adobe Commerce 2.4.7-p1, 2.4.6-p6, 2.4.5-p8, 2.4.4-p9 and earlier. Adobe addressed the issue in security bulletin APSB24-61.

Critical Impact

Successful exploitation grants arbitrary code execution on the underlying web server, exposing customer data, payment processing logic, and the entire storefront infrastructure to compromise.

Affected Products

  • Adobe Commerce 2.4.7-p1 and earlier
  • Adobe Commerce 2.4.6-p6, 2.4.5-p8, 2.4.4-p9 and earlier patch lines
  • Magento Open Source (equivalent version ranges)

Discovery Timeline

  • 2024-08-14 - CVE-2024-39397 published to NVD
  • 2024-08-14 - Last updated in NVD database

Technical Details for CVE-2024-39397

Vulnerability Analysis

The vulnerability resides in file upload handling within Adobe Commerce. The application accepts uploaded files without sufficiently validating the file type, extension, or content against an allow-list of safe formats. An attacker can deliver a file containing executable server-side code, for example a PHP script disguised with a permitted extension or MIME type. Once the file is written to a web-accessible directory, the attacker requests the file through the storefront and the PHP interpreter executes the embedded code in the context of the web server process. Exploitation requires no user interaction and no authentication, although attack complexity is reported as high and the scope is changed because code execution affects components beyond the vulnerable upload endpoint.

Root Cause

The root cause is improper validation of uploaded file content and metadata before the file is persisted to disk. The application relies on insufficient checks such as client-supplied MIME type, file extension, or weak server-side filtering. Because of these gaps, dangerous file types such as .php, .phtml, or polyglot files can bypass the upload filter. This pattern aligns with CWE-434.

Attack Vector

Attack delivery is network-based against the public storefront. An unauthenticated remote attacker crafts a multipart upload request to a vulnerable endpoint and submits a payload that survives the validation logic. The attacker then issues a follow-up HTTP request to invoke the uploaded file, triggering arbitrary code execution. The changed scope indicates the impact reaches beyond the immediate vulnerable component, typically affecting the host operating system or other tenants on the platform.

No verified public proof-of-concept code is available at this time. Refer to the Adobe Security Advisory APSB24-61 for vendor-supplied technical details.

Detection Methods for CVE-2024-39397

Indicators of Compromise

  • New or unexpected .php, .phtml, .phar, or other executable files appearing under pub/media/, pub/static/, or other web-writable Magento directories.
  • HTTP POST requests to file upload endpoints followed shortly by GET requests to recently created files with executable extensions.
  • Outbound network connections originating from the web server process to unfamiliar IP addresses or command-and-control infrastructure.
  • Web shell signatures or obfuscated PHP (e.g., eval(base64_decode(...))) within the Magento web root.

Detection Strategies

  • Monitor file integrity across Magento web-writable directories and alert on creation of files with server-executable extensions.
  • Inspect web server access logs for unusual upload activity followed by direct access to newly created files.
  • Deploy web application firewall (WAF) rules to flag multipart uploads containing PHP code markers or suspicious magic bytes.
  • Correlate web server process spawning unexpected child processes such as sh, bash, curl, or wget.

Monitoring Recommendations

  • Centralize Magento application logs, web server logs, and PHP-FPM logs for retention and search.
  • Continuously audit installed Magento versions against the fixed releases listed in APSB24-61.
  • Track outbound connections from the application tier and baseline normal egress patterns.

How to Mitigate CVE-2024-39397

Immediate Actions Required

  • Apply the Adobe security update referenced in APSB24-61 to all production and staging Adobe Commerce and Magento Open Source instances.
  • Inventory all storefronts to identify versions at or below 2.4.7-p1, 2.4.6-p6, 2.4.5-p8, and 2.4.4-p9.
  • Review web-writable directories for unexpected executable files and quarantine any suspicious artifacts.
  • Rotate administrator credentials, API keys, and integration secrets if compromise is suspected.

Patch Information

Adobe released fixed versions concurrently with APSB24-61. Administrators should upgrade to the patched releases identified by Adobe for each supported branch (2.4.7, 2.4.6, 2.4.5, and 2.4.4). Apply the corresponding composer patches or full version upgrades and run bin/magento setup:upgrade followed by cache flush procedures.

Workarounds

  • Restrict execution of PHP and other server-side scripts within media and upload directories via web server configuration.
  • Place a WAF in front of the storefront with rules blocking uploads of files containing PHP tags or executable signatures.
  • Limit network egress from the application tier to allow-listed destinations only, reducing the value of a web shell to an attacker.
bash
# Nginx example: deny PHP execution under Magento media directory
location ~* /pub/media/.*\.(php|phtml|phar|php3|php4|php5|php7)$ {
    deny all;
    return 403;
}

# Apache equivalent in .htaccess within pub/media/
<FilesMatch "\.(php|phtml|phar|php3|php4|php5|php7)$">
    Require all denied
</FilesMatch>

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.