{"id":"GHSA-9v3j-4j64-p937","aliases":["CVE-2022-41951"],"title":"OroPlatform vulnerable to path traversal during temporary file manipulations","description":"### Impact\nPath Traversal is possible in `Oro\\Bundle\\GaufretteBundle\\FileManager::getTemporaryFileName`. \nWith 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. \n\n### Workarounds\nApply patch\n```patch\n--- a/vendor/oro/platform/src/Oro/Bundle/GaufretteBundle/FileManager.php\n+++ b/vendor/oro/platform/src/Oro/Bundle/GaufretteBundle/FileManager.php\n@@ -614,6 +614,10 @@\n      */\n     public function getTemporaryFileName(string $suggestedFileName = null): string\n     {\n+        if ($suggestedFileName) {\n+            $suggestedFileName = basename($suggestedFileName);\n+        }\n+\n         $tmpDir = ini_get('upload_tmp_dir');\n         if (!$tmpDir || !is_dir($tmpDir) || !is_writable($tmpDir)) {\n             $tmpDir = sys_get_temp_dir();\n\n```\n\nOr decorate `Oro\\Bundle\\GaufretteBundle\\FileManager::getTemporaryFileName` in your customization and clear `$suggestedFileName` argument\n\n```php\n    public function getTemporaryFileName(string $suggestedFileName = null): string\n    {\n        if ($suggestedFileName) {\n            $suggestedFileName = basename($suggestedFileName);\n        }\n\n        return parent::getTemporaryFileName($suggestedFileName);\n    }\n```\n\n### References\n - [Path Traversal](https://owasp.org/www-community/attacks/Path_Traversal)\n - [How to Decorate Services](https://symfony.com/doc/5.4/service_container/service_decoration.html)\n\n","severity":"high","score":8.5,"published":"2023-11-27T23:28:52.000Z","modified":"2024-02-16T08:15:01.929Z","withdrawn":false,"knownExploited":false,"affected":[{"ecosystem":"Packagist","name":"oro/platform","ranges":[{"events":[{"introduced":"4.1.0"},{"last_affected":"4.1.13"}],"type":"ECOSYSTEM"}],"versions":["4.1.0","4.1.1","4.1.1-rc","4.1.1-rc2","4.1.10","4.1.11","4.1.12","4.1.13","4.1.2","4.1.3","4.1.4","4.1.5","4.1.6","4.1.7","4.1.8","4.1.9"],"fixed":[]},{"ecosystem":"Packagist","name":"oro/platform","ranges":[{"events":[{"introduced":"4.2.0"},{"last_affected":"4.2.10"}],"type":"ECOSYSTEM"}],"versions":["4.2.0","4.2.1","4.2.10","4.2.2","4.2.3","4.2.4","4.2.5","4.2.6","4.2.7","4.2.8","4.2.9"],"fixed":[]},{"ecosystem":"Packagist","name":"oro/platform","ranges":[{"events":[{"introduced":"5.0.0"},{"fixed":"5.0.8"}],"type":"ECOSYSTEM"}],"versions":["5.0.0","5.0.1","5.0.2","5.0.3","5.0.4","5.0.5","5.0.6","5.0.7"],"fixed":["5.0.8"]}],"references":["https://github.com/oroinc/platform/security/advisories/GHSA-9v3j-4j64-p937","https://nvd.nist.gov/vuln/detail/CVE-2022-41951","https://github.com/oroinc/platform"],"sources":[{"name":"OSV","id":"GHSA-9v3j-4j64-p937","modified":"2024-02-16T08:15:01.929951Z","url":"https://osv.dev/vulnerability/GHSA-9v3j-4j64-p937"}],"assessments":[{"source":"OSV","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H","score":8.5}]}