GitHub Advisoryadvisory · Packagist

GHSA-9v3j-4j64-p937 OroPlatform vulnerable to path traversal during temporary file manipulations

HIGH Published 2023-11-27 Modified 2023-11-27 Official page ↗
Aliases
CVE-2022-41951
Ecosystem
Packagist
Packages
oro/platform
Severity
High
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H
Weaknesses
CWE-22
Reviewed
2023-11-27

Affected packages

• Packagist oro/platform: >= 4.1.0, <= 4.1.13 (no fix yet) • Packagist oro/platform: >= 4.2.0, <= 4.2.10 (no fix yet) • Packagist oro/platform: >= 5.0.0, < 5.0.8 → fixed in 5.0.8

Description

Impact Path Traversal is possible in `Oro\Bundle\GaufretteBundle\FileManager::getTemporaryFileName`. With this method, an attacker can pass the path to a non-existent file, which will allow writing the content to a new file that will be available during script execution. The file will be deleted immediately after the script ends. Workarounds Apply patch ```patch --- a/vendor/oro/platform/src/Oro/Bundle/GaufretteBundle/FileManager.php +++ b/vendor/oro/platform/src/Oro/Bundle/GaufretteBundle/FileManager.php @@ -614,6 +614,10 @@ */ public function getTemporaryFileName(string $suggestedFileName = null): string { + if ($suggestedFileName) { + $suggestedFileName = basename($suggestedFileName); + } + $tmpDir = ini_get('upload_tmp_dir'); if (!$tmpDir || !is_dir($tmpDir) || !is_writable($tmpDir)) { $tmpDir = sys_get_temp_dir(); ``` Or decorate `Oro\Bundle\GaufretteBundle\FileManager::getTemporaryFileName` in your customization and clear `$suggestedFileName` argument ```php public function getTemporaryFileName(string $suggestedFileName = null): string { if ($suggestedFileName) { $suggestedFileName = basename($suggestedFileName); } return parent::getTemporaryFileName($suggestedFileName); } ``` References • Path Traversal • How to Decorate Services

Related

Alias · CVE (1)

  • CVE-2022-41951 OroPlatform is a PHP Business Application Platform (BAP) designed to make development of custom business applications easier and faster. vulnerability

Weakness · CWE (1)

  • CWE-22 Improper Limitation of a Pathname to a Restricted Directory weakness

References