GHSA-9v3j-4j64-p937

Suggest an improvement
Source
https://github.com/advisories/GHSA-9v3j-4j64-p937
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/11/GHSA-9v3j-4j64-p937/GHSA-9v3j-4j64-p937.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-9v3j-4j64-p937
Aliases
Published
2023-11-27T23:28:52Z
Modified
2024-02-16T08:15:01.929951Z
Severity
  • 8.5 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H CVSS Calculator
Summary
OroPlatform vulnerable to path traversal during temporary file manipulations
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

--- 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

    public function getTemporaryFileName(string $suggestedFileName = null): string
    {
        if ($suggestedFileName) {
            $suggestedFileName = basename($suggestedFileName);
        }

        return parent::getTemporaryFileName($suggestedFileName);
    }

References

Database specific
{
    "nvd_published_at": "2023-11-27T21:15:07Z",
    "cwe_ids": [
        "CWE-22"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2023-11-27T23:28:52Z"
}
References

Affected packages

Packagist / oro/platform

Package

Name
oro/platform
Purl
pkg:composer/oro/platform

Affected ranges

Type
ECOSYSTEM
Events
Introduced
4.1.0
Last affected
4.1.13

Affected versions

4.*

4.1.0
4.1.1-rc
4.1.1-rc2
4.1.1
4.1.2
4.1.3
4.1.4
4.1.5
4.1.6
4.1.7
4.1.8
4.1.9
4.1.10
4.1.11
4.1.12
4.1.13

Packagist / oro/platform

Package

Name
oro/platform
Purl
pkg:composer/oro/platform

Affected ranges

Type
ECOSYSTEM
Events
Introduced
4.2.0
Last affected
4.2.10

Affected versions

4.*

4.2.0
4.2.1
4.2.2
4.2.3
4.2.4
4.2.5
4.2.6
4.2.7
4.2.8
4.2.9
4.2.10

Packagist / oro/platform

Package

Name
oro/platform
Purl
pkg:composer/oro/platform

Affected ranges

Type
ECOSYSTEM
Events
Introduced
5.0.0
Fixed
5.0.8

Affected versions

5.*

5.0.0
5.0.1
5.0.2
5.0.3
5.0.4
5.0.5
5.0.6
5.0.7