GHSA-6wh5-mw9h-5c3w: Shopware vulnerable to path traversal via Plugin upload
2.7
Basic Information
Technical Details
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| shopware/platform | composer | >= 6.7.0.0, < 6.7.3.1 | 6.7.3.1 |
| shopware/platform | composer | < 6.6.10.7 | 6.6.10.7 |
| shopware/core | composer | >= 6.7.0.0, < 6.7.3.1 | 6.7.3.1 |
| shopware/core | composer | < 6.6.10.7 | 6.6.10.7 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability is a classic path traversal issue within the plugin upload functionality of Shopware. The root cause lies in the Shopware\Core\Framework\Plugin\PluginExtractor::validatePluginZip function. When validating the contents of an uploaded ZIP archive, the code iterated through the files starting from the third file (index 2), neglecting to check the first two. This oversight allowed an authenticated admin user to craft a malicious ZIP file where the second entry contained path traversal sequences (../).
When the Shopware\Core\Framework\Plugin\PluginManagementService::uploadPlugin or extractPluginZip methods are called, they use the PluginExtractor (renamed to ExtensionExtractor in the patch) to handle the file extraction. The extract method in the extractor calls the flawed validatePluginZip method. Because the validation was skipped for the initial files in the archive, the extractTo operation would proceed to write a file to a directory outside of the intended plugin directory, leading to arbitrary file write. This could be leveraged by an attacker to upload a PHP webshell and achieve remote code execution on the server.
The patch addresses the vulnerability by changing the loop in validatePluginZip to start from the first file (index 0), ensuring all files within the archive are checked for path traversal characters.
Vulnerable functions
Shopware\Core\Framework\Plugin\PluginExtractor::validatePluginZipsrc/Core/Framework/Plugin/PluginExtractor.php
Shopware\Core\Framework\Plugin\PluginExtractor::extractsrc/Core/Framework/Plugin/PluginExtractor.php
Shopware\Core\Framework\Plugin\PluginManagementService::uploadPluginsrc/Core/Framework/Plugin/PluginManagementService.php
Shopware\Core\Framework\Plugin\PluginManagementService::extractPluginZipsrc/Core/Framework/Plugin/PluginManagementService.php