VDB
Sign up
HIGH8.5

GHSA-9v3j-4j64-p937

OroPlatform vulnerable to path traversal during temporary file manipulations

Quick fix

GHSA-9v3j-4j64-p937 — oro/platform: upgrade to the fixed version with the command below.

composer require oro/platform:^5.0.8

Details

### 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](https://owasp.org/www-community/attacks/Path_Traversal) - [How to Decorate Services](https://symfony.com/doc/5.4/service_container/service_decoration.html)

Are you affected?

Enter the version of the package you're using.

Affected packages

Packagist/oro/platform
Introduced in: 4.1.0

No fixed version published yet for oro/platform (composer). Pin to a known-safe version or switch to an alternative.

Packagist/oro/platform
Introduced in: 4.2.0

No fixed version published yet for oro/platform (composer). Pin to a known-safe version or switch to an alternative.

Packagist/oro/platform
Introduced in: 5.0.0Fixed in: 5.0.8
Fixcomposer require oro/platform:^5.0.8

References